File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
src/test/java/org/springframework/data/neo4j/integration/imperative Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 33
33
34
34
import java .util .Collection ;
35
35
import java .util .Collections ;
36
+ import java .util .List ;
36
37
37
38
import static org .assertj .core .api .Assertions .assertThat ;
38
39
@@ -103,6 +104,31 @@ void collectionsShouldHaveCorrectTypes(@Autowired TerritoryRepository repository
103
104
);
104
105
}
105
106
107
+ @ Test // GH-2138
108
+ void resultCollectionShouldHaveCorrectTypes (@ Autowired TerritoryRepository repository ) {
109
+
110
+ try (Session session = driver .session ()) {
111
+ session .run ("CREATE (c:Country:BaseTerritory:BaseEntity{nameEn:'country', countryProperty:'baseCountry'}) " +
112
+ "CREATE (c)-[:LINK]->(:Country:BaseTerritory:BaseEntity{nameEn:'anotherCountry', countryProperty:'large'}) " +
113
+ "CREATE (c)-[:LINK]->(:Continent:BaseTerritory:BaseEntity{nameEn:'continent', continentProperty:'small'}) " +
114
+ "CREATE (c)-[:LINK]->(:GenericTerritory:BaseTerritory:BaseEntity{nameEn:'generic'})" ).consume ();
115
+ }
116
+
117
+ List <Inheritance .BaseTerritory > territories = repository .findAll ();
118
+
119
+ Inheritance .Country country1 = new Inheritance .Country ("country" , "baseCountry" );
120
+ Inheritance .Country country2 = new Inheritance .Country ("anotherCountry" , "large" );
121
+ Inheritance .Continent continent = new Inheritance .Continent ("continent" , "small" );
122
+ Inheritance .GenericTerritory genericTerritory = new Inheritance .GenericTerritory ("generic" );
123
+
124
+ assertThat (territories ).containsExactlyInAnyOrder (
125
+ country1 ,
126
+ country2 ,
127
+ continent ,
128
+ genericTerritory
129
+ );
130
+ }
131
+
106
132
@ Repository
107
133
interface BuildingRepository extends Neo4jRepository <Inheritance .Building , Long > {}
108
134
You can’t perform that action at this time.
0 commit comments