AppendableStaticResourceHandler implements RequestResponseHandler { @Override public void handle(HttpServletRequest request, HttpServletResponse response, HandlerChain chain) throws Exception { if (resourcePaths.isEmpty()) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } response.setContentType(contentType); ServletOutputStream out = response.getOutputStream(); for (String resourcePath : resourcePaths) { InputStream in = this.getClass().getResourceAsStream(resourcePath); if (in == null) { throw new WebsterException("Could not find resource on classpath: " + resourcePath); } copy(in, out); out.write("\n".getBytes()); in.close(); } out.close(); } AppendableStaticResourceHandler(String contentType); @Override void handle(HttpServletRequest request, HttpServletResponse response, HandlerChain chain); void appendResource(String pathInfo);  }
@Test public void testWithNoResourceFiles() throws Exception { handler.handle(request, response, chain); verify(response).sendError(HttpServletResponse.SC_NOT_FOUND); }