use of org.jnosql.artemis.model.Person in project jnosql-artemis by eclipse.
the class DefaultDocumentMapperSelectBuilderTest method shouldSelectWhereNameBetween.
@Test
public void shouldSelectWhereNameBetween() {
DocumentQuery query = mapperBuilder.selectFrom(Person.class).where("id").between(10, 20).build();
DocumentQuery queryExpected = select().from("Person").where("_id").between(10L, 20L).build();
assertEquals(queryExpected, query);
}
use of org.jnosql.artemis.model.Person in project jnosql-artemis by eclipse.
the class DefaultDocumentMapperSelectBuilderTest method shouldSelectWhereNameLte.
@Test
public void shouldSelectWhereNameLte() {
DocumentQuery query = mapperBuilder.selectFrom(Person.class).where("id").lte(10).build();
DocumentQuery queryExpected = select().from("Person").where("_id").lte(10L).build();
assertEquals(queryExpected, query);
}
use of org.jnosql.artemis.model.Person in project jnosql-artemis by eclipse.
the class DefaultDocumentMapperSelectBuilderTest method shouldSelectWhereNameLike.
@Test
public void shouldSelectWhereNameLike() {
DocumentQuery query = mapperBuilder.selectFrom(Person.class).where("name").like("Ada").build();
DocumentQuery queryExpected = select().from("Person").where("name").like("Ada").build();
assertEquals(queryExpected, query);
}
use of org.jnosql.artemis.model.Person in project jnosql-artemis by eclipse.
the class DefaultDocumentMapperSelectBuilderTest method shouldSelectWhereNameGte.
@Test
public void shouldSelectWhereNameGte() {
DocumentQuery query = mapperBuilder.selectFrom(Person.class).where("id").gte(10).build();
DocumentQuery queryExpected = select().from("Person").where("_id").gte(10L).build();
assertEquals(queryExpected, query);
}
use of org.jnosql.artemis.model.Person in project jnosql-artemis by eclipse.
the class DocumentRepositoryAsyncProxyTest method shoudFindByNameSort.
@Test
public void shoudFindByNameSort() {
Consumer<List<Person>> callback = v -> {
};
Sort sort = Sort.of("age", Sort.SortType.ASC);
ArgumentCaptor<DocumentQuery> captor = ArgumentCaptor.forClass(DocumentQuery.class);
ArgumentCaptor<Consumer> consumerCaptor = ArgumentCaptor.forClass(Consumer.class);
personRepository.findByName("name", sort, callback);
verify(template).select(captor.capture(), consumerCaptor.capture());
DocumentQuery query = captor.getValue();
DocumentCondition condition = query.getCondition().get();
assertEquals("Person", query.getDocumentCollection());
assertEquals(Condition.EQUALS, condition.getCondition());
assertEquals(Document.of("name", "name"), condition.getDocument());
assertEquals(callback, consumerCaptor.getValue());
assertEquals(sort, query.getSorts().get(0));
}
Aggregations