HTTPCacheHelper { boolean isCacheableRequest(HTTPRequest request) { if (request.getMethod().isCacheable()) { Optional<CacheControl> cc = request.getCacheControl(); return OptionalUtils.forall(cc, c -> !c.isNoCache() && !c.isNoStore()); } return false; } HTTPCacheHelper(CacheHeaderBuilder cacheHeaderBuilder);   }
@Test public void cacheableRequest() { assertTrue(helper.isCacheableRequest(new HTTPRequest("fooo"))); assertTrue(helper.isCacheableRequest(new HTTPRequest("fooo").withCacheControl(CacheControl.empty()))); assertFalse(helper.isCacheableRequest(new HTTPRequest("fooo", HTTPMethod.POST))); assertFalse(helper.isCacheableRequest(new HTTPRequest("fooo").withCacheControl(new CacheControl.Builder().noStore().noCache().build()))); assertFalse(helper.isCacheableRequest(new HTTPRequest("fooo").withCacheControl(new CacheControl.Builder().noCache().build()))); assertFalse(helper.isCacheableRequest(new HTTPRequest("fooo").withCacheControl(new CacheControl.Builder().noStore().build()))); }