@Test public void shouldCompleteResponseWhenExceptionOnWrite() throws IOException { response.setCharacterEncoding("NON_EXISTENT_ENCODING_FOR_IO_EXCEPTION"); sender.scheduleUpdate(updateRequestFor("vasya")); sender.sendUpdates(screenFor("vasya", "vasyaboard").asMap()); assertTrue(asyncContext.isComplete()); }
@Test public void shouldSendOtherUpdatesWhenExceptionOnWrite() throws UnsupportedEncodingException { MockHttpServletResponse exceptionResponse = new MockHttpServletResponse(); exceptionResponse.setCharacterEncoding("NON_EXISTENT_ENCODING_FOR_IO_EXCEPTION"); MockAsyncContext exceptionContext = new MockAsyncContext(exceptionResponse); sender.scheduleUpdate(new UpdateRequest(exceptionContext, "exception")); sender.scheduleUpdate(updateRequestFor("petya")); sender.sendUpdates( screenFor("petya", "petyaboard").addScreenFor("exception", 123, "exceptionboard").asMap()); assertContainsPlayerBoard(response.getContentAsString(), "petya", "petyaboard"); assertTrue(exceptionContext.isComplete()); }