RedisCache extends AbstractCache<K, V> { @Override public void clear() { try { client.flushdb(); } catch (ConnectionException|IOException e) { throw new RedisCacheException(e); } } 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 clear() throws ConnectionException, IOException { cache.clear(); verify(client).flushdb(); }
@Test(expected = RedisCacheException.class) public void clearThrowConnectionException() throws ConnectionException, IOException { doThrow(new ConnectionException("")).when(client).flushdb(); cache.clear(); }
@Test(expected = RedisCacheException.class) public void clearThrowIOException() throws ConnectionException, IOException { doThrow(new IOException("")).when(client).flushdb(); cache.clear(); }