CompositeRequestDataValueProcessor implements
                                                RequestDataValueProcessor { @Override public Map<String, String> getExtraHiddenFields( HttpServletRequest request) { Map<String, String> result = new LinkedHashMap<String, String>(); for (RequestDataValueProcessor processor : reversedProcessors) { Map<String, String> map = processor.getExtraHiddenFields(request); if (map != null) { result.putAll(map); } } 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 testGetExtraHiddenFieldsNullMapFromProcessorResult() { when(requestDataValueProcessor.getExtraHiddenFields(any( HttpServletRequest.class))).thenReturn(null); Map<String, String> map = compositeRequestDataValueProcessor .getExtraHiddenFields(request); assertThat(map, is(notNullValue())); }
@Test public void testGetExtraHiddenFieldsNotNullMapFromProcessorResult() { when(requestDataValueProcessor.getExtraHiddenFields(any( HttpServletRequest.class))).thenReturn( new HashMap<String, String>()); Map<String, String> map = compositeRequestDataValueProcessor .getExtraHiddenFields(request); assertThat(map, is(notNullValue())); }
@Test public void testGetExtraHiddenFieldsNoProcessors() { compositeRequestDataValueProcessor = new CompositeRequestDataValueProcessor(); Map<String, String> map = compositeRequestDataValueProcessor .getExtraHiddenFields(request); assertThat(map, is(notNullValue())); }