GuavaCache implements org.restheart.cache.Cache<K, V> { @Override public Optional<V> get(K key) { return wrapped.getIfPresent(key); } GuavaCache(long size, EXPIRE_POLICY expirePolicy, long ttl);  GuavaCache(long size, EXPIRE_POLICY expirePolicy, long ttl, Consumer<Map.Entry<K, Optional<V>>> remover); @Override Optional<V> get(K key); @Override void put(K key, V value); @Override void invalidate(K key); @Override Map<K, Optional<V>> asMap(); @Override void cleanUp();  }
@Test public void testGet() { String key = "A"; GuavaCache<String, Integer> instance = new GuavaCache<>(100, Cache.EXPIRE_POLICY.AFTER_WRITE, 10000); instance.put(key, 1); Optional<Integer> result = instance.get(key); assertTrue(result.isPresent()); assertEquals(Integer.valueOf(1), result.get()); }
@Test public void getNonExistent() { GuavaCache<String, Integer> instance = new GuavaCache<>(100, Cache.EXPIRE_POLICY.AFTER_WRITE, 10000); Optional<Integer> result = instance.get("A"); assertNull(result); }