use of jakarta.nosql.column.ColumnQuery in project jnosql-diana by eclipse.
the class SelectQueryParserTest method shouldReturnParserQuery13.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "select * from God where stamina <= -10.23" })
public void shouldReturnParserQuery13(String query) {
ArgumentCaptor<ColumnQuery> captor = ArgumentCaptor.forClass(ColumnQuery.class);
parser.query(query, manager, observer);
Mockito.verify(manager).select(captor.capture());
ColumnQuery columnQuery = captor.getValue();
checkBaseQuery(columnQuery, 0L, 0L);
assertTrue(columnQuery.getCondition().isPresent());
ColumnCondition condition = columnQuery.getCondition().get();
assertEquals(Condition.LESSER_EQUALS_THAN, condition.getCondition());
assertEquals(Column.of("stamina", -10.23), condition.getColumn());
}
use of jakarta.nosql.column.ColumnQuery in project jnosql-diana by eclipse.
the class DefaultColumnTemplateTest method shouldSelect.
@Test
public void shouldSelect() {
ColumnQuery query = select().from("person").build();
subject.select(query);
verify(managerMock).select(query);
}
use of jakarta.nosql.column.ColumnQuery in project jnosql-diana by eclipse.
the class DefaultColumnTemplateTest method shouldReturnSingleResult.
@Test
public void shouldReturnSingleResult() {
ColumnEntity columnEntity = ColumnEntity.of("Person");
columnEntity.addAll(Stream.of(columns).collect(Collectors.toList()));
Mockito.when(managerMock.select(any(ColumnQuery.class))).thenReturn(Stream.of(columnEntity));
ColumnQuery query = select().from("person").build();
Optional<Person> result = subject.singleResult(query);
assertTrue(result.isPresent());
}
use of jakarta.nosql.column.ColumnQuery in project jnosql-diana by eclipse.
the class DefaultColumnTemplateTest method shouldConvertEntity.
@Test
public void shouldConvertEntity() {
Stream<Movie> movies = subject.query("select * from Movie");
ArgumentCaptor<ColumnQuery> queryCaptor = ArgumentCaptor.forClass(ColumnQuery.class);
verify(managerMock).select(queryCaptor.capture());
ColumnQuery query = queryCaptor.getValue();
assertEquals("movie", query.getColumnFamily());
}
use of jakarta.nosql.column.ColumnQuery in project jnosql-diana by eclipse.
the class DefaultColumnTemplateTest method shouldReturnFind.
@Test
public void shouldReturnFind() {
subject.find(Person.class, "10");
ArgumentCaptor<ColumnQuery> queryCaptor = ArgumentCaptor.forClass(ColumnQuery.class);
verify(managerMock).select(queryCaptor.capture());
ColumnQuery query = queryCaptor.getValue();
ColumnCondition condition = query.getCondition().get();
assertEquals("Person", query.getColumnFamily());
assertEquals(ColumnCondition.eq(Column.of("_id", 10L)), condition);
}
Aggregations