  @Test
  public void resetStats() throws Exception {

    String url = setUp(new RequestHandler() {

      @Override
      public void handle(Request request, HttpServletResponse response) {
        response.setHeader(HEADER_ETAG, "1234");
        if ("1234".equals(request.getHeader(HEADER_IF_NONE_MATCH)))
          response.setStatus(HTTP_NOT_MODIFIED);
        else {
          write("hello");
          response.setStatus(HTTP_OK);
        }
      }
    });

    File file = File.createTempFile("cache", ".dir");
    assertTrue(file.delete());
    assertTrue(file.mkdirs());

    EtagCache cache = EtagCache.create(file, ONE_MB);
    assertNotNull(cache);
    assertEquals(0, cache.getHits());
    assertEquals(0, cache.getMisses());

    CacheRequest request = CacheRequest.get(url, cache);
    assertTrue(request.ok());
    request.body();
    assertEquals(0, cache.getHits());
    assertEquals(1, cache.getMisses());
    request = CacheRequest.get(url, cache);
    assertTrue(request.ok());
    assertEquals("hello", request.body());
    assertTrue(request.cached());
    assertEquals(1, cache.getHits());
    assertEquals(1, cache.getMisses());
    cache.resetStats();
    assertEquals(0, cache.getHits());
    assertEquals(0, cache.getMisses());
  }