### Question:
SpyMemcachedAdapter implements MemcachedAdapter { @Override public Object get(CacheNamespace cacheNamespace, String key) { String namespacedKey = getNamespacedKey(cacheNamespace, key); Object value = memcachedClient.get(namespacedKey); log.debug("spymemcachedadapter get key [{}], hit {}.", namespacedKey, value != null); return value; }  void setMemcachedClient(MemcachedClientIF memcachedClient); void setCacheKeyPrefix(String cacheKeyPrefix); @Override void init(OverridableReadOnlyProperties properties); @Override void destroy(); @Override Object get(CacheNamespace cacheNamespace, String key); @Override void set(CacheNamespace cacheNamespace, String key, Object value, int expirySeconds); @Override void delete(CacheNamespace cacheNamespace, String key); @Override long increaseCounter(CacheNamespace cacheNamespace, String key, long by, long defaultValue, int expirySeconds); @Override long getCounter(CacheNamespace cacheNamespace, String key, long defaultValue, int expirySeconds); @Override void evictAll(CacheNamespace cacheNamespace); static final String PROPERTY_KEY_PREFIX; static final String HOST_PROPERTY_KEY; static final String HASH_ALGORITHM_PROPERTY_KEY; static final String OPERATION_TIMEOUT_MILLIS_PROPERTY_KEY; static final String TRANSCODER_PROPERTY_KEY; static final String CACHE_KEY_PREFIX_PROPERTY_KEY; static final String AUTH_GENERATOR_PROPERTY_KEY; static final String AUTH_WAIT_TIME_MILLIS_PROPERTY_KEY; static final String NAMESPACE_NAME_SQUENCE_SEPARATOR; static final int DEFAULT_NAMESPACE_SEQUENCE_EXPIRY_SECONDS; static final long DEFAULT_AUTH_WAIT_TIME_MILLIS; }### Answer:
@Test public void get() throws Exception { givenNamespaceAndKey(new CacheNamespace("books", true), "book#1", "hXm.books@111:book#1"); String cachedValue = "cached value"; when(memcachedClient.get(givenNamespacedKey)).thenReturn(cachedValue); assertThat(spyMemcachedAdapter.get(givenCacheNamespace, givenKey)).isEqualTo(cachedValue); }
@Test public void get_null() throws Exception { givenNamespaceAndKey(new CacheNamespace("authors", true), "authors#10", "hXm.authors@1:authors#10"); when(memcachedClient.get(givenNamespacedKey)).thenReturn(null); assertThat(spyMemcachedAdapter.get(givenCacheNamespace, givenKey)).isNull(); }