RequestCacheControl { @Override public String toString() { StringBuilder buffer = new StringBuilder(); if (_noCache) { appendDirective(buffer, "no-cache"); } if (_noStore) { appendDirective(buffer, "no-store"); } if (_maxAge >= 0) { appendDirective(buffer, "max-age", _maxAge); } if (_maxStale == Integer.MAX_VALUE) { appendDirective(buffer, "max-stale"); } else if (_maxStale >= 0) { appendDirective(buffer, "max-stale", _maxStale); } if (_minFresh >= 0) { appendDirective(buffer, "min-fresh", _minFresh); } if (_noTransform) { appendDirective(buffer, "no-transform"); } if (_onlyIfCached) { appendDirective(buffer, "only-if-cached"); } if (_cacheExtension != null) { for (Map.Entry<String, Optional<String>> entry : _cacheExtension.entrySet()) { appendDirective(buffer, entry.getKey(), entry.getValue()); } } return buffer.toString(); }  static RequestCacheControl valueOf(String value); boolean isNoCache(); boolean isNoStore(); int getMaxAge(); int getMaxStale(); int getMinFresh(); boolean isNoTransform(); boolean isOnlyIfCached(); Map<String, Optional<String>> getCacheExtension(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); static final RequestCacheControl DEFAULT; }
@Test(dataProvider = "toStringData") public void testToString(String value) { assertEquals(RequestCacheControl.valueOf(value).toString(), value); }