List of usage examples for org.springframework.mock.web MockHttpSession setNew
public void setNew(boolean value)
From source file:org.hdiv.filter.ValidatorErrorHandlerTest.java
public void testValidatorErrorHandler() { HttpServletRequest request = HDIVUtil.getHttpServletRequest(); MockHttpSession session = (MockHttpSession) request.getSession(); session.setNew(false); // mark as not new sesssion MockHttpServletResponse response = new MockHttpServletResponse(); this.validatorErrorHandler.handleValidatorError(request, response, HDIVErrorCodes.REQUIRED_PARAMETERS); String redirectUrl = response.getRedirectedUrl(); assertEquals(getConfig().getErrorPage(), redirectUrl); }
From source file:org.cateproject.test.functional.mockmvc.HtmlUnitRequestBuilder.java
private MockHttpSession httpSession(MockHttpServletRequest request, final String sessionid) { MockHttpSession session; synchronized (sessions) { session = sessions.get(sessionid); if (session == null) { session = new HtmlUnitMockHttpSession(request, sessionid); session.setNew(true); synchronized (sessions) { sessions.put(sessionid, session); }//from w w w . j a va2 s .com addSessionCookie(request, sessionid); } else { session.setNew(false); } } return session; }