use of com.opensymphony.xwork2.mock.MockActionProxy in project struts by apache.
the class PrepareInterceptorTest method testFirstCallPrepareDoIsFalse.
public void testFirstCallPrepareDoIsFalse() throws Exception {
MockActionInvocation mai = new MockActionInvocation();
MockActionProxy mockActionProxy = new MockActionProxy();
mockActionProxy.setMethod("submit");
mai.setProxy(mockActionProxy);
mai.setAction(mock.proxy());
mock.expect("prepare");
mock.expect("prepareSubmit");
interceptor.setFirstCallPrepareDo("false");
interceptor.intercept(mai);
}
use of com.opensymphony.xwork2.mock.MockActionProxy in project struts by apache.
the class PrepareInterceptorTest method testPrepareCalledTrue.
public void testPrepareCalledTrue() throws Exception {
MockActionInvocation mai = new MockActionInvocation();
MockActionProxy mockActionProxy = new MockActionProxy();
mockActionProxy.setMethod("execute");
mai.setProxy(mockActionProxy);
mai.setAction(mock.proxy());
mock.expect("prepare");
interceptor.setAlwaysInvokePrepare("true");
interceptor.intercept(mai);
}
use of com.opensymphony.xwork2.mock.MockActionProxy in project struts by apache.
the class PrepareInterceptorTest method testPrepareCalledDefault.
public void testPrepareCalledDefault() throws Exception {
MockActionInvocation mai = new MockActionInvocation();
MockActionProxy mockActionProxy = new MockActionProxy();
mockActionProxy.setMethod("execute");
mai.setProxy(mockActionProxy);
mai.setAction(mock.proxy());
mock.expect("prepare");
interceptor.intercept(mai);
}
use of com.opensymphony.xwork2.mock.MockActionProxy in project struts by apache.
the class ScopedModelDrivenInterceptorTest method testNoScopedModelAction.
public void testNoScopedModelAction() throws Exception {
Action action = new SimpleAction();
MockActionInvocation mai = new MockActionInvocation();
MockActionProxy map = new MockActionProxy();
ActionConfig ac = new ActionConfig.Builder("", "", "").build();
map.setConfig(ac);
mai.setAction(action);
mai.setProxy(map);
inter.intercept(mai);
inter.destroy();
// nothing happends
}
use of com.opensymphony.xwork2.mock.MockActionProxy in project struts by apache.
the class ScopedModelDrivenInterceptorTest method testModelAlreadySetOnAction.
public void testModelAlreadySetOnAction() throws Exception {
inter.setScope("request");
inter.setName("king");
User user = new User();
user.setName("King George");
ScopedModelDriven action = new MyUserScopedModelDrivenAction();
action.setModel(user);
MockActionInvocation mai = new MockActionInvocation();
MockActionProxy map = new MockActionProxy();
ActionConfig ac = new ActionConfig.Builder("", "", "").build();
map.setConfig(ac);
mai.setAction(action);
mai.setProxy(map);
inter.intercept(mai);
inter.destroy();
assertNotNull(action.getModel());
// no scope key as nothing happended
assertNull(action.getScopeKey());
}
Aggregations