@Test @SuppressWarnings(CompilerWarnings.UNCHECKED) public void shouldWrapExecutionExceptionInMemoizationException() throws ExecutionException { final IntPredicate predicate = a -> true; final IntFunction<String> keyFunction = a -> "key"; final Cache<String, Boolean> cache = Mockito.mock(Cache.class); given(cache.get(any(), any())).willThrow(ExecutionException.class); final GuavaCacheBasedIntPredicateMemoizer<String> memoizer = new GuavaCacheBasedIntPredicateMemoizer<>( cache, keyFunction, predicate); thrown.expect(MemoizationException.class); memoizer.test(123); }
@Override public boolean test(final int input) { final KEY key = keyFunction.apply(input); return get(key, givenKey -> Boolean.valueOf(predicate.test(input))).booleanValue(); }
GuavaCacheBasedIntPredicateMemoizer extends AbstractGuavaCacheBasedMemoizer<KEY, Boolean> implements IntPredicate { @Override public boolean test(final int input) { final KEY key = keyFunction.apply(input); return get(key, givenKey -> Boolean.valueOf(predicate.test(input))).booleanValue(); } }
GuavaCacheBasedIntPredicateMemoizer extends AbstractGuavaCacheBasedMemoizer<KEY, Boolean> implements IntPredicate { @Override public boolean test(final int input) { final KEY key = keyFunction.apply(input); return get(key, givenKey -> Boolean.valueOf(predicate.test(input))).booleanValue(); } GuavaCacheBasedIntPredicateMemoizer(
            final Cache<KEY, Boolean> cache,
            final IntFunction<KEY> keyFunction,
            final IntPredicate predicate); }
GuavaCacheBasedIntPredicateMemoizer extends AbstractGuavaCacheBasedMemoizer<KEY, Boolean> implements IntPredicate { @Override public boolean test(final int input) { final KEY key = keyFunction.apply(input); return get(key, givenKey -> Boolean.valueOf(predicate.test(input))).booleanValue(); } GuavaCacheBasedIntPredicateMemoizer(
            final Cache<KEY, Boolean> cache,
            final IntFunction<KEY> keyFunction,
            final IntPredicate predicate); @Override boolean test(final int input); }
GuavaCacheBasedIntPredicateMemoizer extends AbstractGuavaCacheBasedMemoizer<KEY, Boolean> implements IntPredicate { @Override public boolean test(final int input) { final KEY key = keyFunction.apply(input); return get(key, givenKey -> Boolean.valueOf(predicate.test(input))).booleanValue(); } GuavaCacheBasedIntPredicateMemoizer(
            final Cache<KEY, Boolean> cache,
            final IntFunction<KEY> keyFunction,
            final IntPredicate predicate); @Override boolean test(final int input);  }