Search in sources :

Example 81 with ColumnEntity

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());
}
Also used : ColumnEntity(jakarta.nosql.column.ColumnEntity) Column(jakarta.nosql.column.Column) Test(org.junit.jupiter.api.Test)

Example 82 with ColumnEntity

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());
}
Also used : ColumnEntity(jakarta.nosql.column.ColumnEntity) Column(jakarta.nosql.column.Column) Test(org.junit.jupiter.api.Test)

Example 83 with ColumnEntity

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());
}
Also used : ColumnEntity(jakarta.nosql.column.ColumnEntity) Column(jakarta.nosql.column.Column) Test(org.junit.jupiter.api.Test)

Example 84 with ColumnEntity

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());
}
Also used : ColumnEntity(jakarta.nosql.column.ColumnEntity) Column(jakarta.nosql.column.Column) Test(org.junit.jupiter.api.Test)

Example 85 with ColumnEntity

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));
    });
}
Also used : ColumnEntity(jakarta.nosql.column.ColumnEntity) Test(org.junit.jupiter.api.Test)

Aggregations

ColumnEntity (jakarta.nosql.column.ColumnEntity)146 Test (org.junit.jupiter.api.Test)103 Column (jakarta.nosql.column.Column)39 ColumnQuery (jakarta.nosql.column.ColumnQuery)23 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)23 ValueSource (org.junit.jupiter.params.provider.ValueSource)23 Duration (java.time.Duration)13 ArrayList (java.util.ArrayList)13 List (java.util.List)13 Arrays.asList (java.util.Arrays.asList)11 Person (jakarta.nosql.tck.entities.Person)9 ColumnFamilyManager (jakarta.nosql.column.ColumnFamilyManager)8 HashMap (java.util.HashMap)7 Map (java.util.Map)7 Value (jakarta.nosql.Value)6 ColumnPreparedStatement (jakarta.nosql.column.ColumnPreparedStatement)6 ColumnDeleteQuery (jakarta.nosql.column.ColumnDeleteQuery)5 Actor (jakarta.nosql.tck.entities.Actor)5 Director (jakarta.nosql.tck.entities.Director)5 Movie (jakarta.nosql.tck.entities.Movie)5