FileSystem implements HttpFunction { @Override public void service(HttpRequest request, HttpResponse response) throws IOException { File currentDirectory = new File("."); File[] files = currentDirectory.listFiles(); PrintWriter writer = new PrintWriter(response.getWriter()); writer.println("Files:"); for (File f : files) { writer.printf("\t%s%n", f.getName()); } }  @Override void service(HttpRequest request, HttpResponse response);  }
@Test public void filesTest() throws IOException { new FileSystem().service(request, response); writerOut.flush(); assertThat(responseOut.toString()).contains("Files:"); }