List of usage examples for org.springframework.mock.web MockHttpServletResponse flushBuffer
@Override public void flushBuffer()
From source file:fr.mby.portal.coreimpl.EndToEndTest.java
/** * End to end test.//from w w w . j a va 2 s. c om * * @throws Exception */ @Test public void testDispatch() throws Exception { final MockHttpServletRequest request = new MockHttpServletRequest(); final MockHttpServletResponse response = new MockHttpServletResponse(); this.sessionManager.initPortalSession(request, response); this.userActionDispatcher.dispatch(request, response); // Test headers final String actionHeader1 = response.getHeader("actionProp1"); final String renderHeader1 = response.getHeader("renderProp1"); Assert.assertEquals("Bad action header value !", "actionVal1", actionHeader1); Assert.assertEquals("Bad render header value !", "renderVal1", renderHeader1); final Cookie actionCookie1 = response.getCookie("actionCookie1"); final Cookie renderCookie1 = response.getCookie("renderCookie1"); Assert.assertNotNull("Action cookie is null !", actionCookie1); Assert.assertNotNull("Render cookie is null !", renderCookie1); Assert.assertEquals("Bad action cookie value !", "actionCookieVal1", actionCookie1.getValue()); Assert.assertEquals("Bad render cookie value !", "renderCookieVal1", renderCookie1.getValue()); // Test response response.flushBuffer(); final String reponseOutputStream = response.getContentAsString(); Assert.assertEquals("Bad response output stream !", "<html><body><h1>Test</h1></body></html>", reponseOutputStream); }