SimpleCachePopulator extends AbstractCachePopulator<K, V> { public void pupulate() { final List<CacheEntry<K, V>> entries = loadEntries(); for (final CacheEntry<K, V> cacheEntry : entries) { cache.put(cacheEntry.getKey(), cacheEntry.getValue()); } } SimpleCachePopulator(Cache<K, V> cache); void pupulate();  }
@Test public void populate() { Object object = new Object(); List<CacheEntry<Object, Object>> entries = new ArrayList<CacheEntry<Object, Object>>(); entries.add(entry); doReturn(object).when(entry).getKey(); doReturn(object).when(entry).getValue(); doReturn(entries).when(populator).loadEntries(); doNothing().when(cache).put(object, object); populator.pupulate(); verify(cache).put(object, object); verify(populator).loadEntries(); }