|
19 | 19 |
|
20 | 20 | import java.util.ArrayList; |
21 | 21 | import java.util.Collection; |
| 22 | +import java.util.Collections; |
22 | 23 | import java.util.Iterator; |
23 | 24 | import java.util.List; |
24 | 25 | import java.util.Optional; |
@@ -412,7 +413,7 @@ public void shouldFindNodeEntititiesWithRelationshipEntityAndNestedProperty() { |
412 | 413 | assertThat(users.contains(new User("Michal"))).isTrue(); |
413 | 414 | } |
414 | 415 |
|
415 | | - @Test // Relates to DATAGRAPH-601 and, to an extent, DATAGRAPH-761 |
| 416 | + @Test // DATAGRAPH-601, DATAGRAPH-761 |
416 | 417 | public void shouldFindNodeEntitiesByRegularExpressionMatchingOnPropertiesInDerivedFinderMethods() { |
417 | 418 | executeUpdate("CREATE (:Theatre {name:'Odeon', city:'Preston'}), " + "(:Theatre {name:'Vue', city:'Dumfries'}), " |
418 | 419 | + "(:Theatre {name:'PVR', city:'Mumbai'}) "); |
@@ -694,6 +695,19 @@ public void findByIdEqualsInDerivedQueryMethodShouldWork() { |
694 | 695 | assertThat(users).hasSize(1); |
695 | 696 | } |
696 | 697 |
|
| 698 | + @Test // GH-1792 |
| 699 | + public void findByIdInNestedPropertyTraversalShouldWork() { |
| 700 | + executeUpdate("CREATE (r:Theatre {name:'Ritzy', city:'London', capacity: 7500})" |
| 701 | + + " CREATE (u:User {name:'Michal'}) CREATE (u)-[:VISITED]->(r) CREATE (m1:Movie {name:'Speed'})" |
| 702 | + + " CREATE (g:Genre {name:'Thriller'}) CREATE (u)-[:INTERESTED]->(g)"); |
| 703 | + |
| 704 | + long genreId = session.queryForObject(Long.class, "MATCH (g:Genre {name:'Thriller'}) RETURN id(g)", |
| 705 | + Collections.emptyMap()); |
| 706 | + |
| 707 | + List<User> users = userRepository.findAllByInterestedId(genreId); |
| 708 | + assertThat(users).extracting(User::getName).containsExactly("Michal"); |
| 709 | + } |
| 710 | + |
697 | 711 | @Test // DATAGRAPH-1093 |
698 | 712 | public void shouldFindNodeEntitiesByAttributeIgnoringCase() { |
699 | 713 | executeUpdate("CREATE (:Director:Person {name:'Patty Jenkins'})\n" + // |
|
0 commit comments