@Test
public void testNoSuchFile() throws ServletException, IOException {

    final StaticResourceServlet servlet = Mockito
            .mock(StaticResourceServlet.class);
    Mockito.doCallRealMethod()
            .when(servlet)
            .doGet(Matchers.any(HttpServletRequest.class),
                    Matchers.any(HttpServletResponse.class));
    final ServletContext servletContext = Mockito
            .mock(ServletContext.class);
    Mockito.when(servletContext.getRealPath("notexisting.css")).thenReturn(
            new File(rootDirectory, "notexisting.css").getAbsolutePath());
    Mockito.when(servlet.getServletContext()).thenReturn(servletContext);
    final HttpServletRequest request = Mockito
            .mock(HttpServletRequest.class);
    Mockito.when(request.getServletPath()).thenReturn("notexisting.css");
    final HttpServletResponse response = Mockito
            .mock(HttpServletResponse.class);
    servlet.doGet(request, response);
    Mockito.verify(response).setStatus(HttpServletResponse.SC_NOT_FOUND);
}