ExecutionCount implements HttpFunction { @Override public void service(HttpRequest request, HttpResponse response) throws IOException { count.getAndIncrement(); BufferedWriter writer = response.getWriter(); writer.write("Instance execution count: " + count); }  @Override void service(HttpRequest request, HttpResponse response);  }
@Test public void helloExecutionCount() throws IOException { new ExecutionCount().service(request, response); writerOut.flush(); assertThat(responseOut.toString()).contains("Instance execution count: 1"); }