private CacheItem putAndGet(HTTPRequest request) {
   HTTPResponse response = new HTTPResponse(null, Status.OK, new Headers());
   response = storage.insert(REQUEST, response);
   response.consume();
   assertEquals(1, storage.size());
   return storage.get(request);
 }
 @Test
 public void testPutCacheItem() {
   HTTPResponse response = new HTTPResponse(null, Status.OK, new Headers());
   response = storage.insert(REQUEST, response);
   response.consume();
   assertEquals(1, storage.size());
 }
 @Test
 public void testInvalidate() {
   HTTPResponse response = new HTTPResponse(null, Status.OK, new Headers());
   URI requestURI = URI.create("foo");
   HTTPResponse res = storage.insert(REQUEST, response);
   res.consume();
   assertEquals(1, storage.size());
   storage.invalidate(requestURI);
   assertEquals(0, storage.size());
 }
 @Test
 public void testPutUpdatedCacheItem() {
   CacheItem item = putAndGet(REQUEST);
   item.getResponse().consume();
   HTTPResponse response = new HTTPResponse(null, Status.OK, new Headers());
   HTTPResponse res = storage.update(REQUEST, response);
   res.consume();
   final CacheItem cacheItem = storage.get(REQUEST);
   assertNotSame("Items were the same", cacheItem.getCachedTime(), item.getCachedTime());
   cacheItem.getResponse().consume();
 }
 @Test
 public void testPUTWithRealPayload() throws Exception {
   HTTPResponse response =
       new HTTPResponse(
           new InputStreamPayload(new NullInputStream(10), MIMEType.APPLICATION_OCTET_STREAM),
           Status.OK,
           new Headers());
   assertEquals(0, storage.size());
   HTTPResponse res = storage.insert(REQUEST, response);
   res.consume();
   assertEquals(1, storage.size());
 }