Skip to content

Commit

Permalink
fix: saveAll fails when input list is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
jloisel committed Jan 28, 2016
1 parent dcb09ef commit 80757fd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ public T save(final T entity) {

@Override
public List<T> saveAll(final List<T> entities) {
if(entities.isEmpty()) {
return entities;
}

final BulkRequestBuilder bulk = client
.prepareBulk()
.setRefresh(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ public void shouldSaveAll() {
assertEquals(1, saved.size());
repository.delete(saved.get(0));
}

@Test
public void shouldNotSaveAll() {
final List<Person> saved = repository.saveAll(ImmutableList.of());
assertEquals(0, saved.size());
}

@Test
public void shouldFindByFirstname() {
Expand Down

0 comments on commit 80757fd

Please sign in to comment.