LRUCache implements Cache<K, V> { @Override public V get(final K key) { V value = mMap.get(key); if (value == null) { value = mSecondCache.get(key); if (value != null) { mMap.put(key, value); } } return value; } LRUCache(final Cache<K, V> secondCache);  LRUCache(); @Override V get(final K key); @Override void put(final K key, final V value); @Override void clear(); int usedEntries(); Collection<Map.Entry<? super K, ? super V>> getAll(); @Override String toString(); @Override ImmutableMap<K, V> getAll(final Iterable<? extends K> keys); @Override void putAll(final Map<? extends K, ? extends V> map); @Override void toSecondCache(); Map<K, V> getMap(); @Override void remove(final K key); @Override void close();  }
@Test public void test() { for (int i = 1; i < CacheTestHelper.PAGES.length; i++) { final PageContainer cont = cache.get((long) i); final UnorderedKeyValuePage current = (UnorderedKeyValuePage) cont.getComplete(); assertEquals(CacheTestHelper.PAGES[i][0], current); } final PageContainer page = cache.get(0L); assertNull(page); }