public void testNoParameterValueSetWithDefaultParameterName() throws Exception { ParameterMappingInterceptor interceptor = new ParameterMappingInterceptor(); Object handler = new Object(); MockActionRequest request = new MockActionRequest(); MockActionResponse response = new MockActionResponse(); String param = ParameterHandlerMapping.DEFAULT_PARAMETER_NAME; assertNull(response.getRenderParameter(param)); boolean shouldProceed = interceptor.preHandle(request, response, handler); assertTrue(shouldProceed); assertNull(response.getRenderParameter(param)); }
public void testNoEffectForRenderRequest() throws Exception { ParameterMappingInterceptor interceptor = new ParameterMappingInterceptor(); Object handler = new Object(); MockRenderRequest request = new MockRenderRequest(); MockRenderResponse response = new MockRenderResponse(); String param = ParameterHandlerMapping.DEFAULT_PARAMETER_NAME; String value = "someValue"; request.setParameter(param, value); boolean shouldProceed = interceptor.preHandle(request, response, handler); assertTrue(shouldProceed); }
public void testNonDefaultParameterNotMapped() throws Exception { ParameterMappingInterceptor interceptor = new ParameterMappingInterceptor(); Object handler = new Object(); MockActionRequest request = new MockActionRequest(); MockActionResponse response = new MockActionResponse(); String param = "myParam"; String value = "someValue"; request.setParameter(param, value); assertNull(response.getRenderParameter(param)); boolean shouldProceed = interceptor.preHandle(request, response, handler); assertTrue(shouldProceed); assertNull(response.getRenderParameter(param)); assertNull(response.getRenderParameter(ParameterHandlerMapping.DEFAULT_PARAMETER_NAME)); }
public void testNoParameterValueSetWithNonDefaultParameterNameWhenHandlerMappingProvided() throws Exception { String param = "myParam"; ParameterHandlerMapping handlerMapping = new ParameterHandlerMapping(); handlerMapping.setParameterName(param); ParameterMappingInterceptor interceptor = new ParameterMappingInterceptor(); interceptor.setParameterName(param); Object handler = new Object(); MockActionRequest request = new MockActionRequest(); MockActionResponse response = new MockActionResponse(); assertNull(response.getRenderParameter(param)); boolean shouldProceed = interceptor.preHandle(request, response, handler); assertTrue(shouldProceed); assertNull(response.getRenderParameter(param)); }