List<AfterInterceptor> actionAfters = new ArrayList<AfterInterceptor>();
actionAfters.add(actionAfter1);
actionAfters.add(actionAfter2);
ControllerAction action = createStrictMock(ControllerAction.class);
HttpServletRequest request = createStrictMock(HttpServletRequest.class);
TestAction actionBean = createStrictMock(TestAction.class);
ActionBeanSource beanSource = createStrictMock(ActionBeanSource.class);
ActionContext actionContext = new TestContextImpl(request);
// check the expected order of method invocation
expect(action.getBeanSource()).andReturn(beanSource);
expect(beanSource.createBean(actionContext)).andReturn(actionBean);
action.preExecute(actionBean, actionContext);
before1.beforeExecute(actionBean, actionContext);
before2.beforeExecute(actionBean, actionContext);
expect(action.getBeforeInterceptors()).andReturn(actionBefores);
actionBefore1.beforeExecute(actionBean, actionContext);
actionBefore2.beforeExecute(actionBean, actionContext);
expect(action.executeController(actionBean, actionContext)).andReturn(
new ActionForwardViewAdapter(actionForward));
expect(action.getAfterInterceptors()).andReturn(actionAfters);
actionAfter1.afterExecute(actionBean, actionContext, null);
actionAfter2.afterExecute(actionBean, actionContext, null);
after1.afterExecute(actionBean, actionContext, null);
after2.afterExecute(actionBean, actionContext, null);
action.postExecute(actionBean, actionContext, null);
request.setAttribute(InfrastructureKeys.ACTION_BEAN, actionBean);
request.setAttribute(InfrastructureKeys.ACTION_FORWARD, actionForward);
replay(action);
replay(request);
replay(actionBean);
replay(beanSource);