use of jakarta.nosql.column.ColumnEntity 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.ColumnEntity in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldReturnOneColumn.
@Test
public void shouldReturnOneColumn() {
ColumnEntity entity = ColumnEntity.of("entity");
assertEquals(Integer.valueOf(0), Integer.valueOf(entity.size()));
assertTrue(entity.isEmpty());
entity.add(Column.of("name", "name"));
entity.add(Column.of("name2", Value.of("name2")));
assertFalse(entity.isEmpty());
assertEquals(Integer.valueOf(2), Integer.valueOf(entity.size()));
assertFalse(ColumnEntity.of("entity", singletonList(Column.of("name", "name"))).isEmpty());
}
use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldAddANewColumn.
@Test
public void shouldAddANewColumn() {
ColumnEntity entity = new DefaultColumnEntity("name");
entity.add(Column.of("column", 12));
assertFalse(entity.isEmpty());
assertEquals(1, entity.size());
}
use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldNotRemoveByName.
@Test
public void shouldNotRemoveByName() {
ColumnEntity entity = new DefaultColumnEntity("name");
entity.add(Column.of("value", 32D));
assertFalse(entity.remove("value1"));
assertFalse(entity.isEmpty());
}
use of jakarta.nosql.column.ColumnEntity 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);
});
}
Aggregations