CompositeRequestDataValueProcessor implements
                                                RequestDataValueProcessor { public String processAction(HttpServletRequest request, String action) { String result = action; for (RequestDataValueProcessor processor : processors) { result = processActionInvocationHelper.invokeProcessAction( processor, request, action, null); if (!action.equals(result)) { break; } } return result; } CompositeRequestDataValueProcessor(
            RequestDataValueProcessor... processors); String processAction(HttpServletRequest request, String action); @Override String processAction(HttpServletRequest request, String action,
            String method); @Override String processFormFieldValue(HttpServletRequest request, String name,
            String value, String type); @Override Map<String, String> getExtraHiddenFields(
            HttpServletRequest request); @Override String processUrl(HttpServletRequest request, String url);  }
@Test public void testProcessActionSameActionAndResult01() { when(requestDataValueProcessor.processAction(any( HttpServletRequest.class), anyString())).thenReturn("action"); when(requestDataValueProcessor.processAction(any( HttpServletRequest.class), anyString(), nullable(String.class))) .thenReturn("action"); String result = compositeRequestDataValueProcessor.processAction( request, "action"); assertThat(result, is("action")); }
@Test public void testProcessActionDifferectActionAndResult01() { when(requestDataValueProcessor.processAction(any( HttpServletRequest.class), anyString())).thenReturn( "other_action"); when(requestDataValueProcessor.processAction(any( HttpServletRequest.class), anyString(), nullable(String.class))) .thenReturn("other_action"); String result = compositeRequestDataValueProcessor.processAction( request, "action"); assertThat(result, is("other_action")); }
@Test public void testProcessActionNoProcessors01() { compositeRequestDataValueProcessor = new CompositeRequestDataValueProcessor(); String result = compositeRequestDataValueProcessor.processAction( request, "action"); assertThat(result, is("action")); }
@Test public void testProcessActionSameActionAndResult02() { when(requestDataValueProcessor.processAction(any( HttpServletRequest.class), anyString())).thenReturn("action"); when(requestDataValueProcessor.processAction(any( HttpServletRequest.class), anyString(), anyString())) .thenReturn("action"); String result = compositeRequestDataValueProcessor.processAction( request, "action", "method"); assertThat(result, is("action")); }
@Test public void testProcessActionDifferectActionAndResult02() { when(requestDataValueProcessor.processAction(any( HttpServletRequest.class), anyString())).thenReturn( "other_action"); when(requestDataValueProcessor.processAction(any( HttpServletRequest.class), anyString(), anyString())) .thenReturn("other_action"); String result = compositeRequestDataValueProcessor.processAction( request, "action", "method"); assertThat(result, is("other_action")); }
@Test public void testProcessActionNoProcessors02() { compositeRequestDataValueProcessor = new CompositeRequestDataValueProcessor(); String result = compositeRequestDataValueProcessor.processAction( request, "action", "method"); assertThat(result, is("action")); }