GuavaCacheBasedLongSupplierMemoizer extends AbstractGuavaCacheBasedMemoizer<KEY, Long> implements LongSupplier { @Override public long getAsLong() { return get(keySupplier.get(), givenKey -> Long.valueOf(supplier.getAsLong())).longValue(); } GuavaCacheBasedLongSupplierMemoizer(
            final Cache<KEY, Long> cache,
            final Supplier<KEY> keySupplier,
            final LongSupplier supplier); @Override long getAsLong();  }
@Test public void shouldReturnSuppliedValue() { final LongSupplier supplier = () -> 123; final Supplier<String> keySupplier = () -> "key"; final Cache<String, Long> cache = CacheBuilder.newBuilder().build(); final GuavaCacheBasedLongSupplierMemoizer<String> memoizer = new GuavaCacheBasedLongSupplierMemoizer<>( cache, keySupplier, supplier); Assert.assertEquals(123L, memoizer.getAsLong()); }