use of jakarta.nosql.column.Column 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.Column in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldNotFindTypeSupplier.
@Test
public void shouldNotFindTypeSupplier() {
Column column = Column.of("name", "name");
ColumnEntity entity = ColumnEntity.of("entity", singletonList(column));
List<String> names = entity.find("not_find", new TypeReference<List<String>>() {
}).orElse(Collections.emptyList());
Assertions.assertNotNull(names);
Assertions.assertTrue(names.isEmpty());
}
use of jakarta.nosql.column.Column in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldReturnsTheColumnValues.
@Test
public void shouldReturnsTheColumnValues() {
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.getValues(), containsInAnyOrder(Value.of(10), Value.of(11), Value.of(12), Value.of(13), Value.of(16)));
}
use of jakarta.nosql.column.Column in project jnosql-diana by eclipse.
the class ColumnEntityTest method shouldReturnTrueWhenContainsElement.
@Test
public void shouldReturnTrueWhenContainsElement() {
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);
assertTrue(columnFamily.contains("name"));
assertTrue(columnFamily.contains("name2"));
assertTrue(columnFamily.contains("name3"));
assertTrue(columnFamily.contains("name4"));
assertTrue(columnFamily.contains("name5"));
}
use of jakarta.nosql.column.Column in project jnosql-diana by eclipse.
the class ColumnTest method shouldReturnGetClass.
@Test
public void shouldReturnGetClass() {
Value value = Value.of("text");
Column column = Column.of("name", value);
assertEquals(value.get(String.class), column.get(String.class));
}
Aggregations