@Test
public void testRefreshTime() {

    AsyncLoadingCache<String, Boolean> cachedResult = new AsyncLoadingCache<>(100);
    final AtomicBoolean called = new AtomicBoolean(false);
    Supplier<CompletableFuture<Boolean>> supplier = () -> CompletableFuture.completedFuture(called.getAndSet(true));
    consistently("we see the cached value up until the expiration",
            () -> cachedResult.orElseGet("a", supplier).join(), is(false), 75, 10);
    eventually("the cached result expires and we start reading true",
            () -> cachedResult.orElseGet("a", supplier).join(), is(true), 100, 10);
    consistently("any subsequent reads are true",
            () -> cachedResult.orElseGet("a", supplier).join(), is(true), 50, 10);
}