Search in sources :

Example 6 with ColumnEntity

use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.

the class ColumnEntityTest method shouldRemoveByName.

@Test
public void shouldRemoveByName() {
    ColumnEntity entity = new DefaultColumnEntity("name");
    entity.add(Column.of("value", 32D));
    assertTrue(entity.remove("value"));
    assertTrue(entity.isEmpty());
}
Also used : ColumnEntity(jakarta.nosql.column.ColumnEntity) Test(org.junit.jupiter.api.Test)

Example 7 with ColumnEntity

use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.

the class ColumnEntityTest method shouldAvoidDuplicatedColumn.

@Test
public void shouldAvoidDuplicatedColumn() {
    ColumnEntity entity = new DefaultColumnEntity("columnFamily");
    entity.add("name", 10);
    entity.add("name", 13);
    assertEquals(1, entity.size());
    Optional<Column> column = entity.find("name");
    assertEquals(Column.of("name", 13), column.get());
}
Also used : ColumnEntity(jakarta.nosql.column.ColumnEntity) Column(jakarta.nosql.column.Column) Test(org.junit.jupiter.api.Test)

Example 8 with ColumnEntity

use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.

the class ColumnEntityTest method shouldReturnErrorWhenAddAnNullIterable.

@Test
public void shouldReturnErrorWhenAddAnNullIterable() {
    Assertions.assertThrows(NullPointerException.class, () -> {
        ColumnEntity entity = new DefaultColumnEntity("name");
        entity.addAll(null);
    });
}
Also used : ColumnEntity(jakarta.nosql.column.ColumnEntity) Test(org.junit.jupiter.api.Test)

Example 9 with ColumnEntity

use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.

the class ColumnEntityTest method shouldDoCopy.

@Test
public void shouldDoCopy() {
    ColumnEntity entity = ColumnEntity.of("entity", singletonList(Column.of("name", "name")));
    ColumnEntity copy = entity.copy();
    assertNotSame(entity, copy);
    assertEquals(entity, copy);
}
Also used : ColumnEntity(jakarta.nosql.column.ColumnEntity) Test(org.junit.jupiter.api.Test)

Example 10 with ColumnEntity

use of jakarta.nosql.column.ColumnEntity in project jnosql-diana by eclipse.

the class ColumnEntityTest method shouldReturnFalseWhenDoesNotContainElement.

@Test
public void shouldReturnFalseWhenDoesNotContainElement() {
    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);
    assertFalse(columnFamily.contains("name6"));
    assertFalse(columnFamily.contains("name7"));
    assertFalse(columnFamily.contains("name8"));
    assertFalse(columnFamily.contains("name9"));
    assertFalse(columnFamily.contains("name10"));
}
Also used : ColumnEntity(jakarta.nosql.column.ColumnEntity) Column(jakarta.nosql.column.Column) 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