SearchWebHandler implements WebHandler { public void retrieveImage(OutputStream output) throws IOException { InputStream image = getClass().getResourceAsStream("/images/galago.png"); StreamUtil.copyStream(image, output); output.close(); } SearchWebHandler(Search search); String getEscapedString(String text); void handleDocument(HttpServletRequest request, HttpServletResponse response); void handleSnippet(HttpServletRequest request, HttpServletResponse response); void retrieveImage(OutputStream output); void handleImage(HttpServletRequest request, HttpServletResponse response); void handleSearch(HttpServletRequest request, HttpServletResponse response); void handleSearchXML(HttpServletRequest request, HttpServletResponse response); void handleXCount(HttpServletRequest request, HttpServletResponse response); void handleDocCount(HttpServletRequest request, HttpServletResponse response); void handleStats(HttpServletRequest request, HttpServletResponse response); void handleParts(HttpServletRequest request, HttpServletResponse response); void handleTransformQuery(HttpServletRequest request, HttpServletResponse response); void writeCollectionSelector(PrintWriter writer); void writeStyle(PrintWriter writer); void handleMainPage(HttpServletRequest request, HttpServletResponse response); void handle(HttpServletRequest request, HttpServletResponse response);  }
@Test public void testImage() throws IOException { SearchWebHandler handler = new SearchWebHandler(null); ByteArrayOutputStream stream = new ByteArrayOutputStream(); handler.retrieveImage(stream); assertNotEquals(0, stream.size()); }