use of jakarta.nosql.column.ColumnQuery in project jnosql-diana by eclipse.
the class DefaultColumnMapperSelectBuilderTest method shouldConvertField.
@Test
public void shouldConvertField() {
ColumnQuery query = mapperBuilder.selectFrom(Person.class).where("id").eq("20").build();
ColumnQuery queryExpected = select().from("Person").where("_id").eq(20L).build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.column.ColumnQuery in project jnosql-diana by eclipse.
the class DefaultColumnMapperSelectBuilderTest method shouldExecuteSingleQueryPagination.
@Test
public void shouldExecuteSingleQueryPagination() {
Pagination pagination = Pagination.page(2).size(2);
ColumnTemplate template = Mockito.mock(ColumnTemplate.class);
ArgumentCaptor<ColumnQuery> queryCaptor = ArgumentCaptor.forClass(ColumnQuery.class);
mapperBuilder.selectFrom(Person.class).getSingleResult(template, pagination);
Mockito.verify(template).singleResult(queryCaptor.capture());
ColumnQuery query = queryCaptor.getValue();
assertEquals(pagination.getLimit(), query.getLimit());
assertEquals(pagination.getSkip(), query.getSkip());
}
use of jakarta.nosql.column.ColumnQuery in project jnosql-diana by eclipse.
the class DefaultColumnMapperSelectBuilderTest method shouldSelectWhereNameGte.
@Test
public void shouldSelectWhereNameGte() {
ColumnQuery query = mapperBuilder.selectFrom(Person.class).where("id").gte(10).build();
ColumnQuery queryExpected = select().from("Person").where("_id").gte(10L).build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.column.ColumnQuery in project jnosql-diana by eclipse.
the class DefaultColumnMapperSelectBuilderTest method shouldSelectOrderAsc.
@Test
public void shouldSelectOrderAsc() {
ColumnQuery query = mapperBuilder.selectFrom(Worker.class).orderBy("salary").asc().build();
ColumnQuery queryExpected = select().from("Worker").orderBy("money").asc().build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.column.ColumnQuery in project jnosql-diana by eclipse.
the class DefaultColumnMapperSelectBuilderTest method shouldUseAttributeConverter.
@Test
public void shouldUseAttributeConverter() {
ColumnQuery query = mapperBuilder.selectFrom(Worker.class).where("salary").eq(new Money("USD", BigDecimal.TEN)).build();
ColumnQuery queryExpected = select().from("Worker").where("money").eq("USD 10").build();
assertEquals(queryExpected, query);
}
Aggregations