@Test
public void testDoGetResponseThrowsIOException() throws Exception {

    MockLogService logservice = new MockLogService();
    HttpServletRequest request = mock(HttpServletRequest.class);
    when(request.getMethod()).thenReturn("GET");
    when(request.getRequestURL()).thenReturn(new StringBuffer("http://localhost:8181/ukelonn/"));
    when(request.getRequestURI()).thenReturn("http://localhost:8181/ukelonn/");
    when(request.getPathInfo()).thenReturn("/");
    MockHttpServletResponse response = mock(MockHttpServletResponse.class, CALLS_REAL_METHODS);
    response.resetAll();
    ServletOutputStream streamThrowingIOException = mock(ServletOutputStream.class);
    doThrow(IOException.class).when(streamThrowingIOException).write(anyInt());
    when(response.getOutputStream()).thenReturn(streamThrowingIOException);
    UkelonnServlet servlet = new UkelonnServlet();
    servlet.setLogService(logservice);
    servlet.service(request, response);
    assertEquals(500, response.getStatus());
}