Skip to content

Commit d36c265

Browse files
committed
added test case : should return iterable books
1 parent 952289a commit d36c265

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/test/java/org/springframework/data/elasticsearch/repositories/SampleBookRepositoryTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,17 @@ public void shouldReturnBooksForCustomMethodsWithOrCriteria(){
184184
Page<Book> books = repository.findByNameOrPrice("message", 10, new PageRequest(0, 10));
185185
assertThat(books.getContent().size(), is(2));
186186
}
187+
188+
@Test
189+
public void shouldGiveIterableOfBooks() {
190+
Book book1 = new Book(RandomStringUtils.random(5),"test Or",System.currentTimeMillis());
191+
Book book2 = new Book(RandomStringUtils.random(5),"test And",System.currentTimeMillis());
192+
book1.setPrice(10L);
193+
book2.setPrice(10L);
194+
repository.save(Arrays.asList(book1, book2));
195+
196+
Iterable<Book> books = repository.search(matchAllQuery());
197+
assertThat(books, is(notNullValue()));
198+
}
199+
187200
}

0 commit comments

Comments
 (0)