ServerCacheControl extends CacheControl { @Override public boolean isEmpty() { return super.isEmpty() && !cachePublic && !cachePrivate && !immutable && !mustRevalidate && !proxyRevalidate && sMaxAgeSeconds < 0; } ServerCacheControl(boolean noCache, boolean noStore, boolean noTransform, long maxAgeSeconds,
                       boolean cachePublic, boolean cachePrivate, boolean immutable,
                       boolean mustRevalidate, boolean proxyRevalidate, long sMaxAgeSeconds); static ServerCacheControl parse(String... directives); static ServerCacheControl parse(Iterable<String> directives); static ServerCacheControlBuilder builder(); @Override boolean isEmpty(); boolean cachePublic(); boolean cachePrivate(); boolean immutable(); boolean mustRevalidate(); boolean proxyRevalidate(); long sMaxAgeSeconds(); @Override ServerCacheControlBuilder toBuilder(); @Override String asHeaderValue(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); static final ServerCacheControl EMPTY; static final ServerCacheControl DISABLED; static final ServerCacheControl REVALIDATED; static final ServerCacheControl IMMUTABLE; }
@Test public void testIsEmpty() { final ServerCacheControl cc = ServerCacheControl.builder().build(); assertThat(cc.isEmpty()).isTrue(); assertThat(cc.noCache()).isFalse(); assertThat(cc.noStore()).isFalse(); assertThat(cc.noTransform()).isFalse(); assertThat(cc.maxAgeSeconds()).isEqualTo(-1); assertThat(cc.cachePublic()).isFalse(); assertThat(cc.cachePrivate()).isFalse(); assertThat(cc.immutable()).isFalse(); assertThat(cc.mustRevalidate()).isFalse(); assertThat(cc.proxyRevalidate()).isFalse(); assertThat(cc.sMaxAgeSeconds()).isEqualTo(-1); assertThat(cc.asHeaderValue()).isEmpty(); assertThat(cc.toString()).isEqualTo("ServerCacheControl(<empty>)"); }