use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldReturnAnErrorWhenAddANullColumn.
@Test
public void shouldReturnAnErrorWhenAddANullColumn() {
Assertions.assertThrows(NullPointerException.class, () -> {
ColumnEntity entity = new DefaultColumnEntity("name");
entity.add(null);
});
}
use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldNotFindColumn.
@Test
public void shouldNotFindColumn() {
ColumnEntity entity = new DefaultColumnEntity("name");
Optional<Column> column = entity.find("name");
assertFalse(column.isPresent());
}
use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldAddAllColumns.
@Test
public void shouldAddAllColumns() {
ColumnEntity entity = new DefaultColumnEntity("name");
entity.addAll(Arrays.asList(Column.of("name", 12), Column.of("value", "value")));
assertFalse(entity.isEmpty());
assertEquals(2, entity.size());
}
use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldReturnErrorWhenAddColumnsObjectWhenHasNullObject.
@Test
public void shouldReturnErrorWhenAddColumnsObjectWhenHasNullObject() {
Assertions.assertThrows(NullPointerException.class, () -> {
ColumnEntity entity = new DefaultColumnEntity("columnFamily");
entity.add("name", null);
});
}
use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldFindValue.
@Test
public void shouldFindValue() {
Column column = Column.of("name", "name");
ColumnEntity entity = ColumnEntity.of("entity", singletonList(column));
Optional<String> name = entity.find("name", String.class);
Assertions.assertNotNull(name);
Assertions.assertTrue(name.isPresent());
Assertions.assertEquals("name", name.orElse(""));
}
Aggregations