use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-artemis by eclipse.
the class DefaultColumnEntityConverterTest method shouldConvertEntityFromColumnEntity.
@Test
public void shouldConvertEntityFromColumnEntity() {
Person person = Person.builder().withAge().withId(12).withName("Otavio").withPhones(asList("234", "2342")).build();
ColumnEntity entity = converter.toColumn(person);
assertEquals("Person", entity.getName());
assertEquals(4, entity.size());
assertThat(entity.getColumns(), containsInAnyOrder(Column.of("_id", 12L), Column.of("age", 10), Column.of("name", "Otavio"), Column.of("phones", Arrays.asList("234", "2342"))));
}
use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-artemis 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);
assertTrue(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());
}
use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-artemis 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());
}
use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-artemis by eclipse.
the class DefaultColumnEntityConverterTest method shouldConvertColumnEntityFromEntity.
@Test
public void shouldConvertColumnEntityFromEntity() {
ColumnEntity entity = converter.toColumn(actor);
assertEquals("Actor", entity.getName());
assertEquals(6, entity.size());
assertThat(entity.getColumns(), containsInAnyOrder(columns));
}
use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-artemis by eclipse.
the class DefaultColumnEventPersistManagerTest method shouldFirePreColumn.
@Test
public void shouldFirePreColumn() {
ColumnEntity entity = ColumnEntity.of("columnFamily");
subject.firePreColumn(entity);
ArgumentCaptor<ColumnEntityPrePersist> captor = ArgumentCaptor.forClass(ColumnEntityPrePersist.class);
verify(columnEntityPrePersistEvent).fire(captor.capture());
ColumnEntityPrePersist captorValue = captor.getValue();
assertEquals(entity, captorValue.getEntity());
}
Aggregations