|
21 | 21 |
|
22 | 22 | import java.util.ArrayList;
|
23 | 23 | import java.util.Collection;
|
| 24 | +import java.util.Collections; |
24 | 25 | import java.util.Iterator;
|
25 | 26 | import java.util.List;
|
26 | 27 | import java.util.Optional;
|
@@ -412,7 +413,7 @@ public void shouldFindNodeEntititiesWithRelationshipEntityAndNestedProperty() {
|
412 | 413 | assertTrue(users.contains(new User("Michal")));
|
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'}) ");
|
@@ -683,6 +684,20 @@ public void findByIdEqualsInDerivedQueryMethodShouldWork() {
|
683 | 684 | assertThat(users).hasSize(1);
|
684 | 685 | }
|
685 | 686 |
|
| 687 | + @Test // GH-1792 |
| 688 | + public void findByIdInNestedPropertyTraversalShouldWork() { |
| 689 | + executeUpdate("CREATE (r:Theatre {name:'Ritzy', city:'London', capacity: 7500})" |
| 690 | + + " CREATE (u:User {name:'Michal'}) CREATE (u)-[:VISITED]->(r) CREATE (m1:Movie {name:'Speed'})" |
| 691 | + + " CREATE (g:Genre {name:'Thriller'}) CREATE (u)-[:INTERESTED]->(g)"); |
| 692 | + |
| 693 | + long genreId = session.queryForObject(Long.class, "MATCH (g:Genre {name:'Thriller'}) RETURN id(g)", |
| 694 | + Collections.emptyMap()); |
| 695 | + |
| 696 | + List<User> users = userRepository.findAllByInterestedId(genreId); |
| 697 | + assertEquals(1, users.size()); |
| 698 | + assertEquals("Michal", users.get(0).getName()); |
| 699 | + } |
| 700 | + |
686 | 701 | @Test // DATAGRAPH-1093
|
687 | 702 | public void shouldFindNodeEntitiesByAttributeIgnoringCase() {
|
688 | 703 | executeUpdate("CREATE (:Director:Person {name:'Patty Jenkins'})\n" + //
|
|
0 commit comments