@Test public final void testWriteFileNamesToResponseShouldWriteFileNames() throws IOException { given(path.toFile()).willReturn(file); given(messageFileListJsonBuilder.buildLogFileListJson(file)).willReturn("files"); given(request.getHeader("User-Agent")).willReturn("windows"); underTest.writeFileNamesToResponse(response, path); verify(response).setContentType("application/json"); verify(printWriter).write("files"); verify(printWriter).flush(); verify(printWriter).close(); }
public void writeFileNamesToResponse(final HttpServletResponse resp, final Path path) throws IOException { PrintWriter out = resp.getWriter(); resp.setContentType(APPLICATION_JSON); out.write(messageFileJsonBuilder.buildLogFileListJson(path.toFile())); out.flush(); out.close(); }
LogFileHandler { public void writeFileNamesToResponse(final HttpServletResponse resp, final Path path) throws IOException { PrintWriter out = resp.getWriter(); resp.setContentType(APPLICATION_JSON); out.write(messageFileJsonBuilder.buildLogFileListJson(path.toFile())); out.flush(); out.close(); } }
LogFileHandler { public void writeFileNamesToResponse(final HttpServletResponse resp, final Path path) throws IOException { PrintWriter out = resp.getWriter(); resp.setContentType(APPLICATION_JSON); out.write(messageFileJsonBuilder.buildLogFileListJson(path.toFile())); out.flush(); out.close(); }  }
LogFileHandler { public void writeFileNamesToResponse(final HttpServletResponse resp, final Path path) throws IOException { PrintWriter out = resp.getWriter(); resp.setContentType(APPLICATION_JSON); out.write(messageFileJsonBuilder.buildLogFileListJson(path.toFile())); out.flush(); out.close(); }  void writeFileNamesToResponse(final HttpServletResponse resp, final Path path); void writeFileContentToResponse(final HttpServletRequest req, final HttpServletResponse resp, final String pathInfo, final Path path); }
LogFileHandler { public void writeFileNamesToResponse(final HttpServletResponse resp, final Path path) throws IOException { PrintWriter out = resp.getWriter(); resp.setContentType(APPLICATION_JSON); out.write(messageFileJsonBuilder.buildLogFileListJson(path.toFile())); out.flush(); out.close(); }  void writeFileNamesToResponse(final HttpServletResponse resp, final Path path); void writeFileContentToResponse(final HttpServletRequest req, final HttpServletResponse resp, final String pathInfo, final Path path);  }