RedisCache extends AbstractCache<K, V> { @Override public boolean contains(final K key) { return get(key) != null; } RedisCache(final String name, final CacheLoader<K, V> cacheLoader,
      final EvictionListener<K, V> evictionListener,
      Serializer<Object> serializer, Client client); @Override void put(final K key, final V value); @Override void put(final K key, final V value, final TimeUnit timeUnit, final long duration); @Override @SuppressWarnings("unchecked") V get(final K key); @Override @SuppressWarnings("unchecked") V invalidate(final K key); @Override boolean contains(final K key); @Override void clear(); @Override long size(); @Override CacheStats stats();  }
@Test public void contains() throws ConnectionException, IOException { int key = 3; int value = 5; doReturn(serializer.serialize(value)).when(client).get(serializer.serialize(key)); assertTrue(cache.contains(key)); }