InMemoryStore implements LocalStore { @Override public void delete(byte[] key, Version version) { Preconditions.checkNotNull(key, "key is null"); ByteBuffer wrappedKey = ByteBuffer.wrap(key); boolean done = false; while (!done) { Entry old = map.get(wrappedKey); done = true; if (old != null && EnumSet.of(AFTER, SAME).contains(version.compare(old.getVersion()))) { done = map.remove(wrappedKey, old); } } } @Inject  InMemoryStore(ConflictResolver resolver); @Override void put(Entry entry); @Override Entry get(byte[] key); @Override void delete(byte[] key, Version version); @Override Iterable<Entry> getAll();  }
@Test public void testDelete() { byte[] key = "blue".getBytes(Charsets.UTF_8); Entry entry = entryOf("blue", "apple", 1, 0); store.put(entry); store.delete(key, entry.getVersion()); assertNull(store.get(key)); }