class MemcachedResponseStore extends ResponseStore {

    @Override
    public void invalidate(String key) {
        checkNotNull(key);
        checkArgument(key.length() > 0, "key can not be empty");

        if (!_readOnly) {
            _client.delete(buildKey(key));
        }
    }

}

class MemcachedResponseStoreTest {

    @Test(dataProvider = "invalidateData")
    public void invalidate(String prefix, boolean readOnly, String key, String memcacheKey) {

        MemcachedClient client = mock(MemcachedClient.class);
        MemcachedResponseStore store = new MemcachedResponseStore(client, prefix, readOnly);
        store.invalidate(key);

        if (!readOnly) {
            verify(client).delete(memcacheKey);
        }

        verifyNoMoreInteractions(client);
    }

}