Search in sources :

Example 6 with TestEntity

use of io.spine.server.entity.storage.given.ColumnTestEnv.TestEntity in project core-java by SpineEventEngine.

the class ColumnShould method check_value_if_getter_is_not_null.

@Test(expected = NullPointerException.class)
public void check_value_if_getter_is_not_null() {
    final EntityColumn column = forMethod("getNotNull", TestEntity.class);
    column.getFor(new TestEntity(""));
}
Also used : TestEntity(io.spine.server.entity.storage.given.ColumnTestEnv.TestEntity) BrokenTestEntity(io.spine.server.entity.storage.given.ColumnTestEnv.BrokenTestEntity) Test(org.junit.Test)

Example 7 with TestEntity

use of io.spine.server.entity.storage.given.ColumnTestEnv.TestEntity in project core-java by SpineEventEngine.

the class ColumnShould method allow_nulls_if_getter_is_nullable.

@Test
public void allow_nulls_if_getter_is_nullable() {
    final EntityColumn column = forMethod("getNull", TestEntity.class);
    final Object value = column.getFor(new TestEntity(""));
    assertNull(value);
}
Also used : TestEntity(io.spine.server.entity.storage.given.ColumnTestEnv.TestEntity) BrokenTestEntity(io.spine.server.entity.storage.given.ColumnTestEnv.BrokenTestEntity) Test(org.junit.Test)

Example 8 with TestEntity

use of io.spine.server.entity.storage.given.ColumnTestEnv.TestEntity in project core-java by SpineEventEngine.

the class ColumnShould method memoize_value_regarding_nulls.

@Test
public void memoize_value_regarding_nulls() {
    final EntityColumn nullableColumn = forMethod("getNull", TestEntity.class);
    final MemoizedValue memoizedNull = nullableColumn.memoizeFor(new TestEntity(""));
    assertTrue(memoizedNull.isNull());
    assertNull(memoizedNull.getValue());
}
Also used : TestEntity(io.spine.server.entity.storage.given.ColumnTestEnv.TestEntity) BrokenTestEntity(io.spine.server.entity.storage.given.ColumnTestEnv.BrokenTestEntity) MemoizedValue(io.spine.server.entity.storage.EntityColumn.MemoizedValue) Test(org.junit.Test)

Aggregations

TestEntity (io.spine.server.entity.storage.given.ColumnTestEnv.TestEntity)8 Test (org.junit.Test)8 BrokenTestEntity (io.spine.server.entity.storage.given.ColumnTestEnv.BrokenTestEntity)6 MemoizedValue (io.spine.server.entity.storage.EntityColumn.MemoizedValue)5 EqualsTester (com.google.common.testing.EqualsTester)1 Version (io.spine.core.Version)1