@Test @SuppressWarnings("unchecked") public void computeIfAbsent () throws Exception { Object object2 = new Object(); Callable<Object> callable = Mockito.spy(Callable.class); doReturn(object2).when(callable).call(); expiringObject = new Expiring<>(object, Duration.ZERO); await().atLeast(100, TimeUnit.MILLISECONDS).until(() -> expiringObject.isExpired()); assertEquals(object2, expiringObject.computeIfAbsent(callable, Duration.ZERO)); verify(callable, atLeastOnce()).call(); }
public T computeIfAbsent (Callable<T> callable, long durationInMillis) { return computeIfAbsent(callable, Duration.ofMillis(durationInMillis)); }
Expiring { public T computeIfAbsent (Callable<T> callable, long durationInMillis) { return computeIfAbsent(callable, Duration.ofMillis(durationInMillis)); } }
Expiring { public T computeIfAbsent (Callable<T> callable, long durationInMillis) { return computeIfAbsent(callable, Duration.ofMillis(durationInMillis)); } Expiring(T object, Instant expiryTime);  Expiring(T object, long millis);  Expiring(T object, Duration objectDuration); }
Expiring { public T computeIfAbsent (Callable<T> callable, long durationInMillis) { return computeIfAbsent(callable, Duration.ofMillis(durationInMillis)); } Expiring(T object, Instant expiryTime);  Expiring(T object, long millis);  Expiring(T object, Duration objectDuration); T value(); @Override String toString(); void expire(); T computeIfAbsent(Callable<T> callable, long durationInMillis); T computeIfAbsent(Callable<T> callable, Duration objectDuration); }
Expiring { public T computeIfAbsent (Callable<T> callable, long durationInMillis) { return computeIfAbsent(callable, Duration.ofMillis(durationInMillis)); } Expiring(T object, Instant expiryTime);  Expiring(T object, long millis);  Expiring(T object, Duration objectDuration); T value(); @Override String toString(); void expire(); T computeIfAbsent(Callable<T> callable, long durationInMillis); T computeIfAbsent(Callable<T> callable, Duration objectDuration);  }