use of jakarta.nosql.document.DocumentQuery in project jnosql-diana 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 jakarta.nosql.document.DocumentQuery in project jnosql-diana by eclipse.
the class DefaultDocumentMapperSelectBuilderTest method shouldExecuteQueryPagination.
@Test
public void shouldExecuteQueryPagination() {
Pagination pagination = Pagination.page(2).size(2);
DocumentTemplate template = Mockito.mock(DocumentTemplate.class);
ArgumentCaptor<DocumentQuery> queryCaptor = ArgumentCaptor.forClass(DocumentQuery.class);
mapperBuilder.selectFrom(Person.class).getResult(template, pagination);
Mockito.verify(template).select(queryCaptor.capture());
DocumentQuery query = queryCaptor.getValue();
assertEquals(pagination.getLimit(), query.getLimit());
assertEquals(pagination.getSkip(), query.getSkip());
}
use of jakarta.nosql.document.DocumentQuery in project jnosql-diana by eclipse.
the class DefaultDocumentMapperSelectBuilderTest method shouldSelectStart.
@Test
public void shouldSelectStart() {
DocumentQuery query = mapperBuilder.selectFrom(Worker.class).skip(10).build();
DocumentQuery queryExpected = select().from("Worker").skip(10L).build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.document.DocumentQuery in project jnosql-diana by eclipse.
the class DefaultDocumentMapperSelectBuilderTest method shouldSelectWhereNameEq.
@Test
public void shouldSelectWhereNameEq() {
DocumentQuery query = mapperBuilder.selectFrom(Person.class).where("name").eq("Ada").build();
DocumentQuery queryExpected = select().from("Person").where("name").eq("Ada").build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.document.DocumentQuery in project jnosql-diana by eclipse.
the class DefaultDocumentMapperSelectBuilderTest method shouldExecuteSingleQueryPagination.
@Test
public void shouldExecuteSingleQueryPagination() {
Pagination pagination = Pagination.page(2).size(2);
DocumentTemplate template = Mockito.mock(DocumentTemplate.class);
ArgumentCaptor<DocumentQuery> queryCaptor = ArgumentCaptor.forClass(DocumentQuery.class);
mapperBuilder.selectFrom(Person.class).getSingleResult(template, pagination);
Mockito.verify(template).singleResult(queryCaptor.capture());
DocumentQuery query = queryCaptor.getValue();
assertEquals(pagination.getLimit(), query.getLimit());
assertEquals(pagination.getSkip(), query.getSkip());
}
Aggregations