@Test public void testDelete() { PersonStore store = new PersonStore(new StoreConfig(), ticker); store.put("foo", createPerson("foo@example.com", "Mr Foo")); store.delete("foo"); assertThat(store.get("foo")).isNull(); assertThat(store.getAll()).isEmpty(); }
public boolean delete(String id) { requireNonNull(id, "id must not be null"); Person removedPerson = persons.remove(id); if (removedPerson != null) { stats.personRemoved(); } return removedPerson != null; }
PersonStore { public boolean delete(String id) { requireNonNull(id, "id must not be null"); Person removedPerson = persons.remove(id); if (removedPerson != null) { stats.personRemoved(); } return removedPerson != null; } }
PersonStore { public boolean delete(String id) { requireNonNull(id, "id must not be null"); Person removedPerson = persons.remove(id); if (removedPerson != null) { stats.personRemoved(); } return removedPerson != null; } @Inject  PersonStore(StoreConfig config, Ticker ticker); }
PersonStore { public boolean delete(String id) { requireNonNull(id, "id must not be null"); Person removedPerson = persons.remove(id); if (removedPerson != null) { stats.personRemoved(); } return removedPerson != null; } @Inject  PersonStore(StoreConfig config, Ticker ticker); @Flatten PersonStoreStats getStats(); Person get(String id); boolean put(String id, Person person); boolean delete(String id); Collection<StoreEntry> getAll(); }
PersonStore { public boolean delete(String id) { requireNonNull(id, "id must not be null"); Person removedPerson = persons.remove(id); if (removedPerson != null) { stats.personRemoved(); } return removedPerson != null; } @Inject  PersonStore(StoreConfig config, Ticker ticker); @Flatten PersonStoreStats getStats(); Person get(String id); boolean put(String id, Person person); boolean delete(String id); Collection<StoreEntry> getAll();  }