Spring Framework MockActionRequest - 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 MockActionRequest class.

This code example shows how to use the following methods:
		ModelAndView mav = controller.handleRenderRequest(request, response); 
		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
This code example shows how to use the following methods:getPortletSession, setParameter
	} 
 
	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")); 
	} 
 
	public void testCreateFlowExecutionUrl() { 
		String url = urlHandler.createFlowExecutionUrl("foo", "12345", renderResponse); 
		assertEquals("http://localhost/mockportlet?urlType=action;param_execution=12345", url); 
	} 
} 
6
CodeRank
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
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