Search in sources :

Example 1 with ThingResult3

use of org.neo4j.ogm.domain.gh750.ThingResult3 in project neo4j-ogm by neo4j.

the class SingleUseEntityMapperTest method shouldWorkWithCustomConvertersOnListProperty.

// GH-750
@Test
public void shouldWorkWithCustomConvertersOnListProperty() {
    SingleUseEntityMapper entityMapper = new SingleUseEntityMapper(sessionFactory.metaData(), new ReflectionEntityInstantiator(sessionFactory.metaData()));
    Iterable<Map<String, Object>> results = sessionFactory.openSession().query("RETURN ['foo', 'bar'] AS foobars", EMPTY_MAP).queryResults();
    assertThat(results).hasSize(1);
    ThingResult3 thingResult = entityMapper.map(ThingResult3.class, results.iterator().next());
    assertThat(thingResult.getFoobars()).extracting(ThingResult3.FooBar::getValue).containsExactlyInAnyOrder("foo", "bar");
}
Also used : HashMap(java.util.HashMap) Map(java.util.Map) ReflectionEntityInstantiator(org.neo4j.ogm.metadata.reflect.ReflectionEntityInstantiator) ThingResult3(org.neo4j.ogm.domain.gh750.ThingResult3) Test(org.junit.Test)

Example 2 with ThingResult3

use of org.neo4j.ogm.domain.gh750.ThingResult3 in project neo4j-ogm by neo4j.

the class SingleUseEntityMapperTest method shouldWorkWithCustomConverters.

// GH-750
@Test
public void shouldWorkWithCustomConverters() {
    SingleUseEntityMapper entityMapper = new SingleUseEntityMapper(sessionFactory.metaData(), new ReflectionEntityInstantiator(sessionFactory.metaData()));
    Iterable<Map<String, Object>> results = sessionFactory.openSession().query("RETURN 'foo' AS foobar", EMPTY_MAP).queryResults();
    assertThat(results).hasSize(1);
    ThingResult3 thingResult = entityMapper.map(ThingResult3.class, results.iterator().next());
    assertThat(thingResult.getFoobar()).isNotNull();
    assertThat(thingResult.getFoobar().getValue()).isEqualTo("foo");
}
Also used : HashMap(java.util.HashMap) Map(java.util.Map) ReflectionEntityInstantiator(org.neo4j.ogm.metadata.reflect.ReflectionEntityInstantiator) ThingResult3(org.neo4j.ogm.domain.gh750.ThingResult3) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)2 Map (java.util.Map)2 Test (org.junit.Test)2 ThingResult3 (org.neo4j.ogm.domain.gh750.ThingResult3)2 ReflectionEntityInstantiator (org.neo4j.ogm.metadata.reflect.ReflectionEntityInstantiator)2