|
15 | 15 | */
|
16 | 16 | package org.springframework.data.neo4j.integration.reactive;
|
17 | 17 |
|
18 |
| -import static org.assertj.core.api.Assertions.assertThat; |
19 |
| -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; |
20 |
| -import static org.assertj.core.api.Assertions.tuple; |
21 |
| - |
22 |
| -import org.springframework.data.neo4j.integration.shared.common.BidirectionalAssignedId; |
23 |
| -import org.springframework.data.neo4j.integration.shared.common.BidirectionalExternallyGeneratedId; |
24 |
| -import org.springframework.data.neo4j.integration.shared.common.DtoPersonProjection; |
25 |
| -import org.springframework.data.neo4j.integration.shared.common.EntitiesWithDynamicLabels; |
26 |
| -import org.springframework.data.neo4j.integration.shared.common.SimplePerson; |
27 |
| -import org.springframework.data.neo4j.integration.shared.common.ThingWithFixedGeneratedId; |
28 |
| -import reactor.core.publisher.Flux; |
29 |
| -import reactor.core.publisher.Mono; |
30 |
| -import reactor.test.StepVerifier; |
31 |
| - |
32 |
| -import java.time.LocalDate; |
33 |
| -import java.util.ArrayList; |
34 |
| -import java.util.Arrays; |
35 |
| -import java.util.Collection; |
36 |
| -import java.util.Collections; |
37 |
| -import java.util.HashMap; |
38 |
| -import java.util.HashSet; |
39 |
| -import java.util.List; |
40 |
| -import java.util.Map; |
41 |
| -import java.util.Optional; |
42 |
| -import java.util.Set; |
43 |
| -import java.util.UUID; |
44 |
| -import java.util.stream.Collectors; |
45 |
| -import java.util.stream.IntStream; |
46 |
| - |
47 | 18 | import org.junit.jupiter.api.BeforeEach;
|
48 | 19 | import org.junit.jupiter.api.Nested;
|
49 | 20 | import org.junit.jupiter.api.Tag;
|
|
69 | 40 | import org.springframework.data.domain.ExampleMatcher;
|
70 | 41 | import org.springframework.data.domain.PageRequest;
|
71 | 42 | import org.springframework.data.domain.Sort;
|
| 43 | +import org.springframework.data.mapping.MappingException; |
72 | 44 | import org.springframework.data.neo4j.config.AbstractReactiveNeo4jConfig;
|
73 | 45 | import org.springframework.data.neo4j.core.DatabaseSelection;
|
74 | 46 | import org.springframework.data.neo4j.core.ReactiveDatabaseSelectionProvider;
|
|
79 | 51 | import org.springframework.data.neo4j.integration.shared.common.AltLikedByPersonRelationship;
|
80 | 52 | import org.springframework.data.neo4j.integration.shared.common.AltPerson;
|
81 | 53 | import org.springframework.data.neo4j.integration.shared.common.AnotherThingWithAssignedId;
|
| 54 | +import org.springframework.data.neo4j.integration.shared.common.BidirectionalAssignedId; |
82 | 55 | import org.springframework.data.neo4j.integration.shared.common.BidirectionalEnd;
|
| 56 | +import org.springframework.data.neo4j.integration.shared.common.BidirectionalExternallyGeneratedId; |
83 | 57 | import org.springframework.data.neo4j.integration.shared.common.BidirectionalStart;
|
84 | 58 | import org.springframework.data.neo4j.integration.shared.common.Club;
|
85 | 59 | import org.springframework.data.neo4j.integration.shared.common.DeepRelationships;
|
| 60 | +import org.springframework.data.neo4j.integration.shared.common.DtoPersonProjection; |
| 61 | +import org.springframework.data.neo4j.integration.shared.common.EntitiesWithDynamicLabels; |
86 | 62 | import org.springframework.data.neo4j.integration.shared.common.EntityWithConvertedId;
|
87 | 63 | import org.springframework.data.neo4j.integration.shared.common.Hobby;
|
88 | 64 | import org.springframework.data.neo4j.integration.shared.common.ImmutablePerson;
|
|
94 | 70 | import org.springframework.data.neo4j.integration.shared.common.PersonWithRelationshipWithProperties;
|
95 | 71 | import org.springframework.data.neo4j.integration.shared.common.Pet;
|
96 | 72 | import org.springframework.data.neo4j.integration.shared.common.SimilarThing;
|
| 73 | +import org.springframework.data.neo4j.integration.shared.common.SimplePerson; |
97 | 74 | import org.springframework.data.neo4j.integration.shared.common.ThingWithAssignedId;
|
| 75 | +import org.springframework.data.neo4j.integration.shared.common.ThingWithFixedGeneratedId; |
98 | 76 | import org.springframework.data.neo4j.integration.shared.common.ThingWithGeneratedId;
|
99 | 77 | import org.springframework.data.neo4j.integration.shared.common.WorksInClubRelationship;
|
100 | 78 | import org.springframework.data.neo4j.repository.ReactiveNeo4jRepository;
|
|
110 | 88 | import org.springframework.transaction.ReactiveTransactionManager;
|
111 | 89 | import org.springframework.transaction.annotation.EnableTransactionManagement;
|
112 | 90 | import org.springframework.transaction.reactive.TransactionalOperator;
|
| 91 | +import reactor.core.publisher.Flux; |
| 92 | +import reactor.core.publisher.Mono; |
| 93 | +import reactor.test.StepVerifier; |
| 94 | + |
| 95 | +import java.time.LocalDate; |
| 96 | +import java.util.ArrayList; |
| 97 | +import java.util.Arrays; |
| 98 | +import java.util.Collection; |
| 99 | +import java.util.Collections; |
| 100 | +import java.util.HashMap; |
| 101 | +import java.util.HashSet; |
| 102 | +import java.util.List; |
| 103 | +import java.util.Map; |
| 104 | +import java.util.Optional; |
| 105 | +import java.util.Set; |
| 106 | +import java.util.UUID; |
| 107 | +import java.util.stream.Collectors; |
| 108 | +import java.util.stream.IntStream; |
| 109 | + |
| 110 | +import static org.assertj.core.api.Assertions.assertThat; |
| 111 | +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; |
| 112 | +import static org.assertj.core.api.Assertions.tuple; |
113 | 113 |
|
114 | 114 | /**
|
115 | 115 | * @author Gerrit Meier
|
@@ -869,9 +869,14 @@ void loadEntityWithBidirectionalRelationship(@Autowired BidirectionalStartReposi
|
869 | 869 | startId = startNode.id();
|
870 | 870 | }
|
871 | 871 |
|
872 |
| - StepVerifier.create(repository.findById(startId)).assertNext(entity -> { |
873 |
| - assertThat(entity.getEnds()).hasSize(1); |
874 |
| - }).verifyComplete(); |
| 872 | + StepVerifier.create(repository.findById(startId)) |
| 873 | + .verifyErrorMatches(error -> { |
| 874 | + Throwable cause = error.getCause(); |
| 875 | + return cause instanceof MappingException && cause.getMessage().equals( |
| 876 | + "The node with id " + startId + " has a logical cyclic mapping dependency. " + |
| 877 | + "Its creation caused the creation of another node that has a reference to this."); |
| 878 | + }); |
| 879 | + |
875 | 880 | }
|
876 | 881 |
|
877 | 882 | @Test
|
|
0 commit comments