InMemoryStore implements LocalStore { @Override public void put(Entry entry) { ByteBuffer key = ByteBuffer.wrap(entry.getKey()); boolean done = false; while (!done) { Entry old = map.putIfAbsent(key, entry); done = true; if (old != null) { entry = resolver.resolve(old, entry); if (entry != old) { done = map.replace(key, old, entry); } } } } @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 testPut() { Entry entry = entryOf("blue", "apple", 1, 0); store.put(entry); assertEquals(store.get("blue".getBytes(Charsets.UTF_8)), entry); }