use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldCreateAnEmptyEntity.
@Test
public void shouldCreateAnEmptyEntity() {
ColumnEntity entity = new DefaultColumnEntity("name");
assertTrue(entity.isEmpty());
}
use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldConvertToMap.
@Test
public void shouldConvertToMap() {
Column column = Column.of("name", "name");
ColumnEntity entity = ColumnEntity.of("entity", singletonList(column));
Map<String, Object> result = entity.toMap();
assertFalse(result.isEmpty());
assertEquals(Integer.valueOf(1), Integer.valueOf(result.size()));
assertEquals(column.getName(), result.keySet().stream().findAny().get());
}
use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldNotFindValue.
@Test
public void shouldNotFindValue() {
Column column = Column.of("name", "name");
ColumnEntity entity = ColumnEntity.of("entity", singletonList(column));
Optional<String> name = entity.find("not_found", String.class);
Assertions.assertNotNull(name);
Assertions.assertFalse(name.isPresent());
}
use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldReturnErrorWhenRemovedNameIsNull.
@Test
public void shouldReturnErrorWhenRemovedNameIsNull() {
Assertions.assertThrows(NullPointerException.class, () -> {
ColumnEntity entity = new DefaultColumnEntity("name");
entity.remove(null);
});
}
use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldReturnsTheColumnNames.
@Test
public void shouldReturnsTheColumnNames() {
List<Column> columns = asList(Column.of("name", 10), Column.of("name2", 11), Column.of("name3", 12), Column.of("name4", 13), Column.of("name5", 14), Column.of("name5", 16));
ColumnEntity columnFamily = ColumnEntity.of("columnFamily", columns);
assertThat(columnFamily.getColumnNames(), containsInAnyOrder("name", "name2", "name3", "name4", "name5"));
}
Aggregations