CacheManager { Client wrap(Client client) { this.originalClient = client; return wrapper; } CacheManager();  CacheManager(int depth, long ttl, Cache.KeyGenerator keyGenerator);  CacheManager(Cache backing, Cache.KeyGenerator keyGenerator);   }
@Test void cacheSameRequests() { assertSame( cache.wrap(client).request(new HttpRequestNoBody(config, GET, "/"), null, Object.class), cache.wrap(client).request(new HttpRequestNoBody(config, GET, "/"), null, Object.class) ); assertEquals(1, client.invokes); }
@Test void responsesAreDifferentForDifferentTypes() { assertNotSame( cache.wrap(client).request(new HttpRequestNoBody(config, GET, "/"), r -> new StringResponse(new MockRawResponse(), ""), String.class), cache.wrap(client).request(new HttpRequestNoBody(config, GET, "/"), r -> new BasicResponse(new MockRawResponse(), ""), Empty.class) ); assertEquals(2, client.invokes); }