GuavaCache implements MetricIdCache.Cache<T> { @Override public MetricId get(final MetricId base, final T key) throws ExecutionException { return cache.get(key, new Callable<MetricId>() { @Override public MetricId call() throws Exception { return loader.load(base, key); } }); } GuavaCache(MetricIdCache.Loader<T> loader, Cache<T, MetricId> cache); @Override MetricId get(final MetricId base, final T key); @Override void invalidate(T key); @Override void invalidateAll(); static MetricIdCache.Any setup(final Setup setup);  }
@Test public void testSomeCached() { Assert.assertEquals(MetricId.EMPTY.tagged("endpoint", "foo"), endpointCache.get("foo")); Assert.assertEquals(MetricId.EMPTY.tagged("endpoint", "foo"), endpointCache.get("foo")); Assert.assertEquals(1, callCount.get()); Assert.assertEquals(MetricId.EMPTY.tagged("endpoint", "bar"), endpointCache.get("bar")); Assert.assertEquals(2, callCount.get()); }