use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.
the class DefaultSelectQueryBuilderTest method shouldExecuteManager.
@Test
public void shouldExecuteManager() {
ColumnFamilyManager manager = Mockito.mock(ColumnFamilyManager.class);
ArgumentCaptor<ColumnQuery> queryCaptor = ArgumentCaptor.forClass(ColumnQuery.class);
String columnFamily = "columnFamily";
Stream<ColumnEntity> entities = select().from(columnFamily).getResult(manager);
entities.collect(Collectors.toList());
Mockito.verify(manager).select(queryCaptor.capture());
checkQuery(queryCaptor, columnFamily);
}
use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.
the class InsertQueryParserTest method shouldReturnParserQuery4.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "insert God (name = \"Diana\") 10 minute" })
public void shouldReturnParserQuery4(String query) {
ArgumentCaptor<ColumnEntity> captor = ArgumentCaptor.forClass(ColumnEntity.class);
ArgumentCaptor<Duration> durationCaptor = ArgumentCaptor.forClass(Duration.class);
parser.query(query, manager, observer);
Mockito.verify(manager).insert(captor.capture(), durationCaptor.capture());
ColumnEntity entity = captor.getValue();
Duration duration = durationCaptor.getValue();
assertEquals("God", entity.getName());
assertEquals(Column.of("name", "Diana"), entity.find("name").get());
assertEquals(Duration.ofMinutes(10L), duration);
}
use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.
the class InsertQueryParserTest method shouldReturnParserQuery2.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "insert God (name = \"Diana\") 10 day" })
public void shouldReturnParserQuery2(String query) {
ArgumentCaptor<ColumnEntity> captor = ArgumentCaptor.forClass(ColumnEntity.class);
ArgumentCaptor<Duration> durationCaptor = ArgumentCaptor.forClass(Duration.class);
parser.query(query, manager, observer);
Mockito.verify(manager).insert(captor.capture(), durationCaptor.capture());
ColumnEntity entity = captor.getValue();
Duration duration = durationCaptor.getValue();
assertEquals("God", entity.getName());
assertEquals(Column.of("name", "Diana"), entity.find("name").get());
assertEquals(Duration.ofDays(10L), duration);
}
use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.
the class InsertQueryParserTest method shouldReturnParserQuery.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "insert God (name = \"Diana\")" })
public void shouldReturnParserQuery(String query) {
ArgumentCaptor<ColumnEntity> captor = ArgumentCaptor.forClass(ColumnEntity.class);
parser.query(query, manager, observer);
Mockito.verify(manager).insert(captor.capture());
ColumnEntity entity = captor.getValue();
assertEquals("God", entity.getName());
assertEquals(Column.of("name", "Diana"), entity.find("name").get());
}
use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldFindColumn.
@Test
public void shouldFindColumn() {
Column column = Column.of("name", "name");
ColumnEntity entity = ColumnEntity.of("entity", singletonList(column));
Optional<Column> name = entity.find("name");
Optional<Column> notfound = entity.find("not_found");
assertTrue(name.isPresent());
assertFalse(notfound.isPresent());
assertEquals(column, name.get());
}
Aggregations