use of org.neo4j.ogm.domain.gh551.AnotherThing in project neo4j-ogm by neo4j.
the class SingleUseEntityMapperTest method singleUseEntityMapperShouldWorkWithNestedObjects.
// GH-551
@Test
public void singleUseEntityMapperShouldWorkWithNestedObjects() {
SingleUseEntityMapper entityMapper = new SingleUseEntityMapper(sessionFactory.metaData(), new ReflectionEntityInstantiator(sessionFactory.metaData()));
Iterable<Map<String, Object>> results = sessionFactory.openSession().query("MATCH (t:ThingEntity) RETURN 'a name' as something, collect({name: t.name}) as things", EMPTY_MAP).queryResults();
assertThat(results).hasSize(1);
ThingResult thingResult = entityMapper.map(ThingResult.class, results.iterator().next());
assertThat(thingResult.getSomething()).isEqualTo("a name");
assertThat(thingResult.getThings()).hasSize(10).extracting(AnotherThing::getName).allSatisfy(s -> s.startsWith("Thing"));
}
Aggregations