mirror of
https://github.com/apache/struts.git
synced 2026-08-06 23:27:07 +00:00
WW-4716 Allows create actions with all dependencies injected
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user