### Question:
WrappedCache implements Cache<K, V> { @Override public boolean replace( K key, V oldValue, V newValue ) { assertNotClosed(); return cache.asMap().replace( key, oldValue, newValue ); } WrappedCache( com.google.common.cache.Cache<K, V> guavaCache ); @Override V get( K key ); @Override Map<K, V> getAll( Set<? extends K> keys ); @Override boolean containsKey( K key ); @Override void loadAll( Set<? extends K> keys, boolean replaceExistingValues, CompletionListener completionListener ); @Override void put( K key, V value ); @Override V getAndPut( K key, V value ); @Override void putAll( Map<? extends K, ? extends V> map ); @Override boolean putIfAbsent( K key, V value ); @Override boolean remove( K key ); @Override boolean remove( K key, V oldValue ); @Override V getAndRemove( K key ); @Override boolean replace( K key, V oldValue, V newValue ); @Override boolean replace( K key, V value ); @Override V getAndReplace( K key, V value ); @Override void removeAll( Set<? extends K> keys ); @Override void removeAll(); @Override void clear(); @Override T invoke( K key, EntryProcessor<K, V, T> entryProcessor, Object... arguments ); @Override Map<K, EntryProcessorResult<T>> invokeAll( final Set<? extends K> keys,
                                                        final EntryProcessor<K, V, T> entryProcessor,
                                                        final Object... arguments ); @Override Iterator<Entry<K, V>> iterator(); @Override void registerCacheEntryListener( CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration ); @Override void deregisterCacheEntryListener( CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration ); @Override void close(); @Override boolean isClosed(); @Override T unwrap( Class<T> clazz );  }### Answer:
@Test public void testReplace() throws Exception { assertThat( cache.replace( "key", "value" ), is( false ) ); assertThat( cache.putIfAbsent( "key", "value" ), is( true ) ); assertThat( cache.replace( "key", "value", "other value" ), is( true ) ); assertThat( cache.getAndReplace( "key", "value" ), equalTo( (Object) "other value" ) ); assertThat( cache.get( "key" ), equalTo( (Object) "value" ) ); }