use of jakarta.nosql.column.Column in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldConvertSubColumn.
@Test
public void shouldConvertSubColumn() {
Column column = Column.of("name", "name");
ColumnEntity entity = ColumnEntity.of("entity", singletonList(Column.of("sub", column)));
Map<String, Object> result = entity.toMap();
assertFalse(result.isEmpty());
assertEquals(Integer.valueOf(1), Integer.valueOf(result.size()));
Map<String, Object> map = (Map<String, Object>) result.get("sub");
assertEquals("name", map.get("name"));
}
use of jakarta.nosql.column.Column in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldReturnErrorWhenFindColumnIsNull.
@Test
public void shouldReturnErrorWhenFindColumnIsNull() {
Assertions.assertThrows(NullPointerException.class, () -> {
Column column = Column.of("name", "name");
ColumnEntity entity = ColumnEntity.of("entity", singletonList(column));
entity.find(null);
});
}
use of jakarta.nosql.column.Column in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldRemoveColumn.
@Test
public void shouldRemoveColumn() {
Column column = Column.of("name", "name");
ColumnEntity entity = ColumnEntity.of("entity", singletonList(column));
assertTrue(entity.remove("name"));
assertTrue(entity.isEmpty());
}
use of jakarta.nosql.column.Column in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldAddColumnAsNameAndValue.
@Test
public void shouldAddColumnAsNameAndValue() {
ColumnEntity entity = new DefaultColumnEntity("columnFamily");
entity.add("name", Value.of(10));
assertEquals(1, entity.size());
Optional<Column> name = entity.find("name");
assertTrue(name.isPresent());
assertEquals(10, name.get().get());
}
use of jakarta.nosql.column.Column in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldAvoidDuplicatedColumnWhenAddList.
@Test
public void shouldAvoidDuplicatedColumnWhenAddList() {
List<Column> columns = asList(Column.of("name", 10), Column.of("name", 13));
ColumnEntity entity = new DefaultColumnEntity("columnFamily");
entity.addAll(columns);
assertEquals(1, entity.size());
assertEquals(1, ColumnEntity.of("columnFamily", columns).size());
}
Aggregations