DefaultCacheControl implements CacheControl { @Override public boolean isCacheReadAllowed(Date dateTime) { return isCacheReadAllowed(dateTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); }  @Override void setCacheReadAllowed(boolean enabled); @Override boolean isCacheReadAllowed(Date dateTime); @Override boolean isCacheReadAllowed(ChronoLocalDateTime<?> dateTime); @Override boolean isCacheReadAllowed();  }
@Test void isCacheReadAllowed() { LocalDateTime now = LocalDateTime.now(); assertTrue(this.cacheControl.isCacheReadAllowed()); assertTrue(this.cacheControl.isCacheReadAllowed(now.minusDays(1))); assertTrue(this.cacheControl.isCacheReadAllowed(now.plusDays(1))); assertTrue(this.cacheControl.isCacheReadAllowed(toDate(now.minusDays(1)))); assertTrue(this.cacheControl.isCacheReadAllowed(toDate(now.plusDays(1)))); this.cacheControl.setCacheReadAllowed(false); assertFalse(this.cacheControl.isCacheReadAllowed()); assertFalse(this.cacheControl.isCacheReadAllowed(now.minusDays(1))); assertTrue(this.cacheControl.isCacheReadAllowed(now.plusDays(1))); assertFalse(this.cacheControl.isCacheReadAllowed(toDate(now.minusDays(1)))); assertTrue(this.cacheControl.isCacheReadAllowed(toDate(now.plusDays(1)))); this.cacheControl.setCacheReadAllowed(true); assertTrue(this.cacheControl.isCacheReadAllowed()); assertTrue(this.cacheControl.isCacheReadAllowed(now.minusDays(1))); assertTrue(this.cacheControl.isCacheReadAllowed(now.plusDays(1))); assertTrue(this.cacheControl.isCacheReadAllowed(toDate(now.minusDays(1)))); assertTrue(this.cacheControl.isCacheReadAllowed(toDate(now.plusDays(1)))); }