Code example for ServletWebRequest

0
 
	@Before 
	public void setUp() throws Exception { 
		this.handler = new ModelAndViewMethodReturnValueHandler(); 
		this.mavContainer = new ModelAndViewContainer(); 
		this.webRequest = new ServletWebRequest(new MockHttpServletRequest()); 
		this.returnParamModelAndView = getReturnValueParam("modelAndView"); 
	} 
 
	@Test 
	public void supportsReturnType() throws Exception { 
		assertTrue(handler.supportsReturnType(returnParamModelAndView)); 
		assertFalse(handler.supportsReturnType(getReturnValueParam("viewName"))); 
	} 
 
	@Test 
	public void handleViewReference() throws Exception { 
		ModelAndView mav = new ModelAndView("viewName", "attrName", "attrValue"); 
		handler.handleReturnValue(mav, returnParamModelAndView, mavContainer, webRequest);