MockHttpServletResponse writer sets committed flag

Issue: SPR-16683
This commit is contained in:
Rossen Stoyanchev
2018-05-10 16:22:54 -04:00
parent 79e809be24
commit d3f3b41f52
3 changed files with 43 additions and 4 deletions

View File

@@ -227,6 +227,16 @@ public class MockHttpServletResponseTests {
assertEquals(1, response.getContentAsByteArray().length);
}
@Test // SPR-16683
public void servletWriterCommittedOnWriterClose() throws IOException {
assertFalse(response.isCommitted());
response.getWriter().write("X");
assertFalse(response.isCommitted());
response.getWriter().close();
assertTrue(response.isCommitted());
assertEquals(1, response.getContentAsByteArray().length);
}
@Test
public void servletWriterAutoFlushedForString() throws IOException {
response.getWriter().write("X");