private MyActionRequest createMyActionRequest(ActionFilter[] actionFilters, ActionInterceptor[] actionInterceptors) { SimpleMadvocController madvocController = new SimpleMadvocController(); Action action = new Action(); ActionRuntime actionRuntime = new ActionRuntime( null, Action.class, ClassUtil.findMethod(Action.class, "view"), actionFilters, actionInterceptors, new ActionDefinition("path", "method"), ServletDispatcherActionResult.class, null, false, false, null, null); return new MyActionRequest( madvocController, "actionPath", actionRuntime, action, null, null); }
@Test void testFiltersPassAndInterceptorsStop2() throws Exception { MyActionRequest actionRequest = createMyActionRequest( arr(new FilterPass(1), new FilterPass(2)), arr(new InterceptorStop(), new InterceptorPass(2)) ); actionRequest.invoke(); assertEquals("-F1-F2-x-R-f2-f1", actionRequest.data); }
@Test void testFiltersPassAndInterceptorsStop1() throws Exception { MyActionRequest actionRequest = createMyActionRequest( arr(new FilterPass(1), new FilterPass(2)), arr(new InterceptorPass(1), new InterceptorStop()) ); actionRequest.invoke(); assertEquals("-F1-F2-I1-x-i1-R-f2-f1", actionRequest.data); }
@Test void testFiltersPassAndInterceptorsPass() throws Exception { MyActionRequest actionRequest = createMyActionRequest( arr(new FilterPass(1), new FilterPass(2)), arr(new InterceptorPass(1), new InterceptorPass(2)) ); actionRequest.invoke(); assertEquals("-F1-F2-I1-I2-A-i2-i1-R-f2-f1", actionRequest.data); }
@Test void testFiltersPassAndInterceptorsStop3() throws Exception { MyActionRequest actionRequest = createMyActionRequest( arr(new FilterPass(1), new FilterPass(2)), arr(new InterceptorPass(1), new InterceptorStop(), new InterceptorPass(3)) ); actionRequest.invoke(); assertEquals("-F1-F2-I1-x-i1-R-f2-f1", actionRequest.data); }
@Test void testFiltersStopAndInterceptorsPass2() throws Exception { MyActionRequest actionRequest = createMyActionRequest( arr(new FilterPass(1), new FilterStop()), arr(new InterceptorPass(1), new InterceptorPass(2)) ); actionRequest.invoke(); assertEquals("-F1-X-f1", actionRequest.data); }
@Test void testFiltersStopAndInterceptorsPass1() throws Exception { MyActionRequest actionRequest = createMyActionRequest( arr(new FilterStop(), new FilterPass(2)), arr(new InterceptorPass(1), new InterceptorPass(2)) ); actionRequest.invoke(); assertEquals("-X", actionRequest.data); }