use of jakarta.nosql.column.ColumnEntity 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.ColumnEntity 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.ColumnEntity 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());
}
use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldAddColumnAsNameAndObject.
@Test
public void shouldAddColumnAsNameAndObject() {
ColumnEntity entity = new DefaultColumnEntity("columnFamily");
entity.add("name", 10);
assertEquals(1, entity.size());
Optional<Column> name = entity.find("name");
assertTrue(name.isPresent());
assertEquals(10, name.get().get());
}
use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldReturnErrorWhenAddColumnsValueWhenHasNullColumnName.
@Test
public void shouldReturnErrorWhenAddColumnsValueWhenHasNullColumnName() {
Assertions.assertThrows(NullPointerException.class, () -> {
ColumnEntity entity = new DefaultColumnEntity("columnFamily");
entity.add(null, Value.of(12));
});
}
Aggregations