Search in sources :

Example 66 with ColumnEntity

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

Example 67 with ColumnEntity

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

Example 68 with ColumnEntity

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

Example 69 with ColumnEntity

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

Example 70 with ColumnEntity

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(""));
}
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