@Test public void testReindexShouldRunReindexThenExceptionRaisedInGetWriter() throws IOException { IOException exception = new IOException(); doThrow(exception).when(response).getWriter(); underTest.reindex(response); verify(indexTaskScheduler).runReindexOnDemand(); verify(logger).info("error occurred when accessing /reindex", exception); }
@RequestMapping(value = "/reindex", method = RequestMethod.GET) public void reindex(final HttpServletResponse response) { indexTaskScheduler.runReindexOnDemand(); PrintWriter writer; try { writer = response.getWriter(); writer.write("Reindexing!"); writer.flush(); } catch (IOException e) { logger.info("error occurred when accessing /reindex", e); } }
ReindexController { @RequestMapping(value = "/reindex", method = RequestMethod.GET) public void reindex(final HttpServletResponse response) { indexTaskScheduler.runReindexOnDemand(); PrintWriter writer; try { writer = response.getWriter(); writer.write("Reindexing!"); writer.flush(); } catch (IOException e) { logger.info("error occurred when accessing /reindex", e); } } }
ReindexController { @RequestMapping(value = "/reindex", method = RequestMethod.GET) public void reindex(final HttpServletResponse response) { indexTaskScheduler.runReindexOnDemand(); PrintWriter writer; try { writer = response.getWriter(); writer.write("Reindexing!"); writer.flush(); } catch (IOException e) { logger.info("error occurred when accessing /reindex", e); } }  }
ReindexController { @RequestMapping(value = "/reindex", method = RequestMethod.GET) public void reindex(final HttpServletResponse response) { indexTaskScheduler.runReindexOnDemand(); PrintWriter writer; try { writer = response.getWriter(); writer.write("Reindexing!"); writer.flush(); } catch (IOException e) { logger.info("error occurred when accessing /reindex", e); } }  @RequestMapping(value = "/reindex", method = RequestMethod.GET) void reindex(final HttpServletResponse response); }
ReindexController { @RequestMapping(value = "/reindex", method = RequestMethod.GET) public void reindex(final HttpServletResponse response) { indexTaskScheduler.runReindexOnDemand(); PrintWriter writer; try { writer = response.getWriter(); writer.write("Reindexing!"); writer.flush(); } catch (IOException e) { logger.info("error occurred when accessing /reindex", e); } }  @RequestMapping(value = "/reindex", method = RequestMethod.GET) void reindex(final HttpServletResponse response);  }