Search in sources :

Example 6 with Actor

use of jakarta.nosql.tck.entities.Actor in project jnosql-diana by eclipse.

the class DefaultColumnEntityConverterTest method shouldReturnErrorWhenToEntityIsNull.

@Test
public void shouldReturnErrorWhenToEntityIsNull() {
    ColumnEntity entity = ColumnEntity.of("Actor");
    Stream.of(columns).forEach(entity::add);
    Actor actor = Actor.actorBuilder().build();
    assertThrows(NullPointerException.class, () -> converter.toEntity(null, entity));
    assertThrows(NullPointerException.class, () -> converter.toEntity(actor, null));
}
Also used : ColumnEntity(jakarta.nosql.column.ColumnEntity) Actor(jakarta.nosql.tck.entities.Actor) Test(org.junit.jupiter.api.Test)

Example 7 with Actor

use of jakarta.nosql.tck.entities.Actor in project jnosql-diana by eclipse.

the class DefaultColumnEntityConverterTest method shouldConvertColumnEntityToEntity2.

@Test
public void shouldConvertColumnEntityToEntity2() {
    ColumnEntity entity = ColumnEntity.of("Actor");
    Stream.of(columns).forEach(entity::add);
    Actor actor = converter.toEntity(entity);
    assertNotNull(actor);
    assertEquals(10, actor.getAge());
    assertEquals(12L, actor.getId());
    assertEquals(asList("234", "2342"), actor.getPhones());
    assertEquals(Collections.singletonMap("JavaZone", "Jedi"), actor.getMovieCharacter());
    assertEquals(Collections.singletonMap("JavaZone", 10), actor.getMovieRating());
}
Also used : ColumnEntity(jakarta.nosql.column.ColumnEntity) Actor(jakarta.nosql.tck.entities.Actor) Test(org.junit.jupiter.api.Test)

Example 8 with Actor

use of jakarta.nosql.tck.entities.Actor in project jnosql-diana by eclipse.

the class DefaultColumnEntityConverterTest method shouldConvertColumnEntityToEntity.

@Test
public void shouldConvertColumnEntityToEntity() {
    ColumnEntity entity = ColumnEntity.of("Actor");
    Stream.of(columns).forEach(entity::add);
    Actor actor = converter.toEntity(Actor.class, entity);
    assertNotNull(actor);
    assertEquals(10, actor.getAge());
    assertEquals(12L, actor.getId());
    assertEquals(asList("234", "2342"), actor.getPhones());
    assertEquals(Collections.singletonMap("JavaZone", "Jedi"), actor.getMovieCharacter());
    assertEquals(Collections.singletonMap("JavaZone", 10), actor.getMovieRating());
}
Also used : ColumnEntity(jakarta.nosql.column.ColumnEntity) Actor(jakarta.nosql.tck.entities.Actor) Test(org.junit.jupiter.api.Test)

Example 9 with Actor

use of jakarta.nosql.tck.entities.Actor in project jnosql-diana by eclipse.

the class DefaultColumnEntityConverterTest method shouldConvertColumnEntityToExistEntity.

@Test
public void shouldConvertColumnEntityToExistEntity() {
    ColumnEntity entity = ColumnEntity.of("Actor");
    Stream.of(columns).forEach(entity::add);
    Actor actor = Actor.actorBuilder().build();
    Actor result = converter.toEntity(actor, entity);
    assertSame(actor, result);
    assertEquals(10, actor.getAge());
    assertEquals(12L, actor.getId());
    assertEquals(asList("234", "2342"), actor.getPhones());
    assertEquals(Collections.singletonMap("JavaZone", "Jedi"), actor.getMovieCharacter());
    assertEquals(Collections.singletonMap("JavaZone", 10), actor.getMovieRating());
}
Also used : ColumnEntity(jakarta.nosql.column.ColumnEntity) Actor(jakarta.nosql.tck.entities.Actor) Test(org.junit.jupiter.api.Test)

Aggregations

Actor (jakarta.nosql.tck.entities.Actor)9 Test (org.junit.jupiter.api.Test)9 DocumentEntity (jakarta.nosql.document.DocumentEntity)5 ColumnEntity (jakarta.nosql.column.ColumnEntity)4 TypeReference (jakarta.nosql.TypeReference)1 Value (jakarta.nosql.Value)1 Document (jakarta.nosql.document.Document)1 Address (jakarta.nosql.tck.entities.Address)1 AppointmentBook (jakarta.nosql.tck.entities.AppointmentBook)1 Contact (jakarta.nosql.tck.entities.Contact)1 ContactType (jakarta.nosql.tck.entities.ContactType)1 Director (jakarta.nosql.tck.entities.Director)1 Download (jakarta.nosql.tck.entities.Download)1 Job (jakarta.nosql.tck.entities.Job)1 Money (jakarta.nosql.tck.entities.Money)1 Movie (jakarta.nosql.tck.entities.Movie)1 Person (jakarta.nosql.tck.entities.Person)1 Vendor (jakarta.nosql.tck.entities.Vendor)1 Worker (jakarta.nosql.tck.entities.Worker)1 ZipCode (jakarta.nosql.tck.entities.ZipCode)1