void () { final int[] counter = new int[1]; final TimeoutCachedValue<Integer> cachedValue = new TimeoutCachedValue<>(50, TimeUnit.MILLISECONDS, () -> { int current = counter[0]++; if (current == 0) { throw new TestProgressCancelException(); } return current; }); assertExceptionThrown(() -> cachedValue.get()); assertEquals(1, cachedValue.get().intValue()); assertEquals(1, cachedValue.get().intValue()); }