DefaultCrudRepository extends CrudRepositorySupport { public Iterable<Object> saveAll(Iterable entities) { return save(entities); }  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 testSave() { final List<Person> entities = Arrays.asList(new Person(), new Person(), new Person()); final Iterable<Object> inserted = repository.saveAll(entities); assertThat(inserted, is(notNullValue())); final List<Object> insertedList = iterableToList(inserted); assertThat(insertedList, hasSize(3)); for (Object item : insertedList) { assertThat(item, is(instanceOf(Person.class))); assertThat((Person) item, isIn(entities)); assertThat(((Person) item).getId(), is(notNullValue())); } assertThat(dataStore.retrieveAll(), hasSize(entities.size())); final Iterable<Object> updated = repository.saveAll(entities); assertThat(updated, is(notNullValue())); final List<Object> updatedList = iterableToList(updated); assertThat(updatedList, hasSize(3)); for (Object item : updatedList) { assertThat(item, is(instanceOf(Person.class))); assertThat((Person) item, isIn(entities)); } assertThat(dataStore.retrieveAll(), hasSize(entities.size())); }