Code example for ServletWebRequest

0
 
	@Before 
	public void setUp() throws NoSuchMethodException { 
		this.handler = new ViewNameMethodReturnValueHandler(); 
		this.mavContainer = new ModelAndViewContainer(); 
		this.webRequest = new ServletWebRequest(new MockHttpServletRequest()); 
		this.param = new MethodParameter(getClass().getDeclaredMethod("viewName"), -1); 
	} 
 
	@Test 
	public void supportsReturnType() throws Exception { 
		assertTrue(this.handler.supportsReturnType(this.param)); 
	} 
 
	@Test 
	public void returnViewName() throws Exception { 
		this.handler.handleReturnValue("testView", this.param, this.mavContainer, this.webRequest); 
		assertEquals("testView", this.mavContainer.getViewName()); 
	} 
 
Contextual code suggestions in your IDE  Get Codota for Java