StaticFileHandler implements RequestResponseHandler { public StaticFileHandler(ServletContext servletContext) { this(servletContext, null); } StaticFileHandler(ServletContext servletContext);  StaticFileHandler(ServletContext servletContext, String pathInfo); @Override void handle(HttpServletRequest request, HttpServletResponse response, HandlerChain chain);  }
@Test public void testStaticFileHandler() throws Exception { HttpServletRequest request = mock(HttpServletRequest.class); HttpServletResponse response = mock(HttpServletResponse.class); ServletContext servletContext = mock(ServletContext.class); RequestDispatcher dispatcher = mock(RequestDispatcher.class); HandlerChain chain = new HandlerChain(null); when(servletContext.getNamedDispatcher("default")).thenReturn(dispatcher); StaticFileHandler handler = new StaticFileHandler(servletContext); handler.handle(request, response, chain); verify(servletContext).getNamedDispatcher("default"); verify(dispatcher).forward(any(HttpServletRequest.class), eq(response)); }