Spring Framework MockActionResponse - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework MockActionResponse class.

This code example shows how to use the following methods:getRenderParameter
 
	public void testNoParameterValueSetWithNonDefaultParameterName() throws Exception {
		ParameterMappingInterceptor interceptor = new ParameterMappingInterceptor();
		Object handler = new Object();
		MockActionRequest request = new MockActionRequest();
		MockActionResponse response = new MockActionResponse();
		String param = "myParam";
		assertNull(response.getRenderParameter(param));
		boolean shouldProceed = interceptor.preHandle(request, response, handler);
		assertTrue(shouldProceed);
		assertNull(response.getRenderParameter(param));
	} 
 
	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();
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
		assertEquals("view", mav.getViewName()); 
	} 
 
	public void testActionRequest() throws Exception { 
		MockActionRequest request = new MockActionRequest(); 
		MockActionResponse response = new MockActionResponse(); 
		try { 
			controller.handleActionRequest(request, response); 
			fail("Should have thrown PortletException"); 
		} 
		catch(PortletException ex) { 
			// expected 
		} 
	} 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
	} 
 
	public void testActionRequestNotHandled() throws Exception {
		ParameterizableViewController controller = new ParameterizableViewController();
		ActionRequest request = new MockActionRequest();
		ActionResponse response = new MockActionResponse();
		try { 
			controller.handleActionRequest(request, response);
			fail("should have thrown PortletException");
		} 
		catch (PortletException ex) {
			// expected 
		} 
	} 
 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getRenderParameter
		request.addParameter("execution", "12345"); 
		assertEquals("12345", urlHandler.getFlowExecutionKey(request)); 
	} 
 
	public void testSetFlowExecutionRenderParameter() { 
		urlHandler.setFlowExecutionRenderParameter("12345", actionResponse); 
		assertEquals("12345", actionResponse.getRenderParameter("execution")); 
	} 
 
	public void testSetFlowExecutionInSession() { 
		urlHandler.setFlowExecutionInSession("12345", renderRequest); 
		assertEquals("12345", renderRequest.getPortletSession().getAttribute("execution")); 
	} 
 
	public void testSessionFlowExecutionRemoval() { 
		urlHandler.setFlowExecutionInSession("12345", renderRequest); 
		assertEquals("12345", urlHandler.getFlowExecutionKey(renderRequest)); 
		actionRequest.setParameter("execution", "12345"); 
		assertEquals("12345", urlHandler.getFlowExecutionKey(actionRequest)); 
		assertNull(actionRequest.getPortletSession().getAttribute("execution")); 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
	private PortletExternalContext renderContext;
 
	protected void setUp() { 
		portletContext = new MockPortletContext();
		request = new MockActionRequest();
		response = new MockActionResponse();
		context = new PortletExternalContext(portletContext, request, response);
		renderRequest = new MockRenderRequest();
		renderResponse = new MockRenderResponse();
		renderContext = new PortletExternalContext(portletContext, renderRequest, renderResponse);
	} 
 
	public void testGetContextPath() { 
		request.setContextPath("/foo");
		assertEquals("/foo", request.getContextPath());
	} 
 
	public void testRequestParameters() { 
		assertTrue(context.getRequestParameterMap().isEmpty());
	} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java