use of org.neo4j.ogm.domain.gh551.ThingResult2 in project neo4j-ogm by neo4j.
the class SingleUseEntityMapperTest method singleUseEntityMapperShouldWorkWithNullableNestedNodeEntities.
// GH-748
@Test
public void singleUseEntityMapperShouldWorkWithNullableNestedNodeEntities() {
SingleUseEntityMapper entityMapper = new SingleUseEntityMapper(sessionFactory.metaData(), new ReflectionEntityInstantiator(sessionFactory.metaData()));
Iterable<Map<String, Object>> results = sessionFactory.openSession().query("WITH 'a name' AS something OPTIONAL MATCH (t:ThingEntity {na:false}) RETURN something, t as entity", EMPTY_MAP).queryResults();
assertThat(results).hasSize(1);
ThingResult2 thingResult = entityMapper.map(ThingResult2.class, results.iterator().next());
assertThat(thingResult.getSomething()).isEqualTo("a name");
assertThat(thingResult.getEntity()).isNull();
}
use of org.neo4j.ogm.domain.gh551.ThingResult2 in project neo4j-ogm by neo4j.
the class SingleUseEntityMapperTest method singleUseEntityMapperShouldWorkWithNonNullNestedNodeEntities.
// GH-748
@Test
public void singleUseEntityMapperShouldWorkWithNonNullNestedNodeEntities() {
SingleUseEntityMapper entityMapper = new SingleUseEntityMapper(sessionFactory.metaData(), new ReflectionEntityInstantiator(sessionFactory.metaData()));
Iterable<Map<String, Object>> results = sessionFactory.openSession().query("WITH 'a name' AS something OPTIONAL MATCH (t:ThingEntity {name: 'Thing 7'}) RETURN something, t as entity", EMPTY_MAP).queryResults();
assertThat(results).hasSize(1);
ThingResult2 thingResult = entityMapper.map(ThingResult2.class, results.iterator().next());
assertThat(thingResult.getSomething()).isEqualTo("a name");
assertThat(thingResult.getEntity()).isNotNull().extracting(ThingEntity::getName).isEqualTo("Thing 7");
}
use of org.neo4j.ogm.domain.gh551.ThingResult2 in project neo4j-ogm by neo4j.
the class SingleUseEntityMapperTest method shouldBeLenientWithSingleValuedCollectionsForSkalarPropertiesMode.
// GH-748
@Test
public void shouldBeLenientWithSingleValuedCollectionsForSkalarPropertiesMode() {
SingleUseEntityMapper entityMapper = new SingleUseEntityMapper(sessionFactory.metaData(), new ReflectionEntityInstantiator(sessionFactory.metaData()));
Iterable<Map<String, Object>> results = sessionFactory.openSession().query("WITH 'a name' AS something OPTIONAL MATCH (t:ThingEntity {name: 'Thing 7'}) RETURN something, COLLECT(t) as entity", EMPTY_MAP).queryResults();
assertThat(results).hasSize(1);
ThingResult2 thingResult = entityMapper.map(ThingResult2.class, results.iterator().next());
assertThat(thingResult.getSomething()).isEqualTo("a name");
assertThat(thingResult.getEntity()).isNotNull().extracting(ThingEntity::getName).isEqualTo("Thing 7");
}
Aggregations