DefaultCrudRepository extends CrudRepositorySupport { public Iterable deleteAll() { log.info("Attempting to delete all entities at once"); final List list = new LinkedList(); final Collection keys = getDataStore().keys(); log.debug("There are " + keys.size() + " entities altogether in the data store that are going to be deleted"); for (Object key : keys) { final Object deleted = delete((key)); if (deleted != null) { log.debug("The entity was deleted successfully and will be added to the list of deleted entities"); list.add(deleted); } } final Collection remainingKeys = getDataStore().keys(); log.debug("There are " + remainingKeys.size() + " keys remaining in the data store after the delete operation"); return list; }  Iterable<Object> saveAll(Iterable entities); Optional<Object> findById(Object key); boolean existsById(Object key); Iterable findAllById(Iterable ids); Object delete(Object id); Object deleteById(Object entity); Iterable delete(Iterable entities); Iterable deleteAll();  }
@Test public void testDeleteAll() { dataStore.save("1", new Person()); dataStore.save("2", new Person()); dataStore.save("3", new Person()); dataStore.save("4", new Person()); assertThat(dataStore.keys(), hasSize(4)); repository.deleteAll(); assertThat(dataStore.keys(), is(empty())); }