@Test public void testMultipleNoCacheFields() { CacheControl cc = new CacheControl(); cc.setNoCache(true); cc.getNoCacheFields().add("c"); cc.getNoCacheFields().add("d"); assertTrue(cc.toString().contains("no-cache=\"c,d\"")); }
@Test public void testMultiplePrivateFields() { CacheControl cc = new CacheControl(); cc.setPrivate(true); cc.getPrivateFields().add("a"); cc.getPrivateFields().add("b"); assertTrue(cc.toString().contains("private=\"a,b\"")); }
@Test public void testCacheExtensionToString() { CacheControl cc = new CacheControl(); cc.getCacheExtension().put("ext1", null); cc.getCacheExtension().put("ext2", "value2"); cc.getCacheExtension().put("ext3", "value 3"); String value = cc.toString(); assertTrue(value.indexOf("ext1") != -1 && value.indexOf("ext1=") == -1); assertTrue(value.indexOf("ext2=value2") != -1); assertTrue(value.indexOf("ext3=\"value 3\"") != -1); }
@Test public void testNoCacheDisabled() { CacheControl cc = new CacheControl(); cc.setNoCache(false); assertEquals("no-transform", cc.toString()); }
@Override public Builder cacheControl(CacheControl control) { webClient.header(HttpHeaders.CACHE_CONTROL, control.toString()); return this; }