use of jakarta.nosql.mapping.column.ColumnTemplate in project jnosql-diana by eclipse.
the class DefaultColumnMapperDeleteBuilderTest method shouldExecuteDeleteFrom.
@Test
public void shouldExecuteDeleteFrom() {
ColumnTemplate template = Mockito.mock(ColumnTemplate.class);
ArgumentCaptor<ColumnDeleteQuery> queryCaptor = ArgumentCaptor.forClass(ColumnDeleteQuery.class);
mapperBuilder.deleteFrom(Person.class).delete(template);
Mockito.verify(template).delete(queryCaptor.capture());
ColumnDeleteQuery query = queryCaptor.getValue();
ColumnDeleteQuery queryExpected = delete().from("Person").build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.mapping.column.ColumnTemplate 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.mapping.column.ColumnTemplate in project jnosql-diana by eclipse.
the class DefaultColumnMapperSelectBuilderTest method shouldExecuteQueryPagination.
@Test
public void shouldExecuteQueryPagination() {
Pagination pagination = Pagination.page(2).size(2);
ColumnTemplate template = Mockito.mock(ColumnTemplate.class);
ArgumentCaptor<ColumnQuery> queryCaptor = ArgumentCaptor.forClass(ColumnQuery.class);
mapperBuilder.selectFrom(Person.class).getResult(template, pagination);
Mockito.verify(template).select(queryCaptor.capture());
ColumnQuery query = queryCaptor.getValue();
assertEquals(pagination.getLimit(), query.getLimit());
assertEquals(pagination.getSkip(), query.getSkip());
}
use of jakarta.nosql.mapping.column.ColumnTemplate in project jnosql-diana by eclipse.
the class DefaultColumnMapperSelectBuilderTest method shouldCreatePage.
@Test
public void shouldCreatePage() {
Pagination pagination = Pagination.page(2).size(2);
ColumnTemplate template = Mockito.mock(ColumnTemplate.class);
ArgumentCaptor<ColumnQueryPagination> queryCaptor = ArgumentCaptor.forClass(ColumnQueryPagination.class);
Page<Person> page = mapperBuilder.selectFrom(Person.class).page(template, pagination);
Mockito.verify(template).select(queryCaptor.capture());
ColumnQuery query = queryCaptor.getValue();
assertEquals(pagination.getLimit(), query.getLimit());
assertEquals(pagination.getSkip(), query.getSkip());
}
use of jakarta.nosql.mapping.column.ColumnTemplate in project jnosql-diana by eclipse.
the class DefaultColumnMapperSelectBuilderTest method shouldExecuteQuery.
@Test
public void shouldExecuteQuery() {
ColumnTemplate template = Mockito.mock(ColumnTemplate.class);
ArgumentCaptor<ColumnQuery> queryCaptor = ArgumentCaptor.forClass(ColumnQuery.class);
mapperBuilder.selectFrom(Person.class).getResult(template);
Mockito.verify(template).select(queryCaptor.capture());
ColumnQuery query = queryCaptor.getValue();
ColumnQuery queryExpected = select().from("Person").build();
assertEquals(queryExpected, query);
}
Aggregations