CacheImpl implements Cache<T> { @Override public void evict(String key) { cacheStore.delete(cacheKey(key)); } CacheImpl(String name, Class<T> cacheClass, Duration duration); @Override T get(String key, Function<String, T> loader); Optional<T> get(String key); @Override Map<String, T> getAll(Collection<String> keys, Function<String, T> loader); @Override void put(String key, T value); @Override void putAll(Map<String, T> values); @Override void evict(String key); @Override void evictAll(Collection<String> keys); final String name; final Class<T> cacheClass; final Duration duration; public CacheStore cacheStore; }
@Test void evict() { cache.evict("key1"); verify(cacheStore).delete("name:key1"); }