WW-4716 Allows create actions with all dependencies injected

This commit is contained in:
Lukasz Lenart
2016-11-20 18:10:03 +01:00
parent 321d9da095
commit 6f7fcaa338
2 changed files with 18 additions and 0 deletions
@@ -152,6 +152,15 @@ public abstract class StrutsTestCase extends XWorkTestCase {
return proxy;
}
/**
* A helper method which allows instantiate an action if this action extends
* {@link com.opensymphony.xwork2.ActionSupport} or any other action class
* that requires framework's dependencies injection.
*/
protected <T> T createAction(Class<T> clazz) {
return container.inject(clazz);
}
protected void initActionContext(ActionContext actionContext) {
actionContext.setParameters(HttpParameters.create(request.getParameterMap()).build());
initSession(actionContext);
@@ -51,6 +51,15 @@ public class StrutsTestCase extends TestNGXWorkTestCase {
return du;
}
/**
* A helper method which allows instantiate an action if this action extends
* {@link com.opensymphony.xwork2.ActionSupport} or any other action class
* that requires framework's dependencies injection.
*/
protected <T> T createAction(Class<T> clazz) {
return container.inject(clazz);
}
@AfterTest
protected void tearDown() throws Exception {
super.tearDown();