@Test public void shouldTestGivenValue() { final IntPredicate predicate = Mockito.mock(IntPredicate.class); final IntFunction<String> keyFunction = a -> "key"; final Cache<String, Boolean> cache = CacheBuilder.newBuilder().build(); final GuavaCacheBasedIntPredicateMemoizer<String> memoizer = new GuavaCacheBasedIntPredicateMemoizer<>( cache, keyFunction, predicate); memoizer.test(123); Mockito.verify(predicate).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);  }