Skip to content

Commit

Permalink
add lesser than query test
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Furlaneto <lucasfurlaneto.s@gmail.com>
  • Loading branch information
furlaneto committed Feb 10, 2018
1 parent cc059ac commit 486e423
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import java.util.Map;
import java.util.Optional;
import java.util.Random;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

import static java.util.Arrays.asList;
import static org.hamcrest.MatcherAssert.assertThat;
Expand Down Expand Up @@ -169,6 +171,22 @@ public void shouldFindDocumentGreaterEqualsThan() {
assertThat(entitiesFound, not(contains(entities.get(0))));
}

@Test
public void shouldFindDocumentLesserThan() {
DocumentDeleteQuery deleteQuery = delete().from(COLLECTION_NAME).where("type").eq("V").build();
entityManager.delete(deleteQuery);
Iterable<DocumentEntity> entitiesSaved = entityManager.insert(getEntitiesWithValues());
List<DocumentEntity> entities = StreamSupport.stream(entitiesSaved.spliterator(), false).collect(Collectors.toList());

DocumentQuery query = select().from(COLLECTION_NAME)
.where("age").lt(23)
.and("type").eq("V")
.build();

List<DocumentEntity> entitiesFound = entityManager.select(query);
assertTrue(entitiesFound.size() == 1);
assertThat(entitiesFound, contains(entities.get(0)));
}

@Test
public void shouldFindAll() {
Expand Down

0 comments on commit 486e423

Please sign in to comment.