sturts2+spring+hibernate组合下对Action进行 容器依赖测试:
class BaseStruts2ActionTestentends StrutsTestCase {
protected void setUp() throws Exception {
super.setUp();
//
/**
* 关键是调用这个方法,使用在StrutsTestCase里被装入的所有provider来初始化XWorkTestCase下的
* ConfigurationManager configurationManager;
* Configuration configuration;
* Container container;
* ActionProxyFactory actionProxyFactory;
* 如果不调用这个方法重新构建configurationManager,将抛出java.lang.UnsupportedOperationException异常
*
*/
this.loadConfigurationProviders((ConfigurationProvider[]) this.configurationManager.getConfigurationProviders()
.toArray(new ConfigurationProvider[0]));
}
public void testXXXXXX(){
......
}
}
class BaseStruts2ActionTestentends StrutsTestCase {
protected void setUp() throws Exception {
super.setUp();
//
/**
* 关键是调用这个方法,使用在StrutsTestCase里被装入的所有provider来初始化XWorkTestCase下的
* ConfigurationManager configurationManager;
* Configuration configuration;
* Container container;
* ActionProxyFactory actionProxyFactory;
* 如果不调用这个方法重新构建configurationManager,将抛出java.lang.UnsupportedOperationException异常
*
*/
this.loadConfigurationProviders((ConfigurationProvider[]) this.configurationManager.getConfigurationProviders()
.toArray(new ConfigurationProvider[0]));
}
public void testXXXXXX(){
......
}
}