@@ -50,21 +50,21 @@ void isNotRootForNonRootPath() {
50
50
51
51
AggregatePath path = context .getAggregatePath (context .getPersistentPropertyPath ("entityId" , DummyEntity .class ));
52
52
53
- assertThat (path . isRoot ()). isFalse ();
53
+ AggregatePathAssertions . assertThat (path ). isNotRoot ();
54
54
}
55
55
56
56
@ Test // GH-1525
57
57
void isRootForRootPath () {
58
58
59
59
AggregatePath path = context .getAggregatePath (entity );
60
60
61
- assertThat (path . isRoot ()). isTrue ();
61
+ AggregatePathAssertions . assertThat (path ). isRoot ();
62
62
}
63
63
64
64
@ Test // GH-1525
65
65
void getParentPath () {
66
66
67
- AggregatePathSoftAssertions .assertNewSoftly (softly -> {
67
+ AggregatePathSoftAssertions .assertAggregatePathsSoftly (softly -> {
68
68
69
69
softly .assertAggregatePath (path ("second.third2.value" ).getParentPath ()).hasPath ("second.third2" );
70
70
softly .assertAggregatePath (path ("second.third2" ).getParentPath ()).hasPath ("second" );
@@ -79,13 +79,13 @@ void getRequiredLeafEntity() {
79
79
80
80
assertSoftly (softly -> {
81
81
82
+ RelationalPersistentEntity <?> secondEntity = context .getRequiredPersistentEntity (Second .class );
83
+ RelationalPersistentEntity <?> thirdEntity = context .getRequiredPersistentEntity (Third .class );
84
+
82
85
softly .assertThat (path ().getRequiredLeafEntity ()).isEqualTo (entity );
83
- softly .assertThat (path ("second" ).getRequiredLeafEntity ())
84
- .isEqualTo (context .getRequiredPersistentEntity (Second .class ));
85
- softly .assertThat (path ("second.third" ).getRequiredLeafEntity ())
86
- .isEqualTo (context .getRequiredPersistentEntity (Third .class ));
87
- softly .assertThat (path ("secondList" ).getRequiredLeafEntity ())
88
- .isEqualTo (context .getRequiredPersistentEntity (Second .class ));
86
+ softly .assertThat (path ("second" ).getRequiredLeafEntity ()).isEqualTo (secondEntity );
87
+ softly .assertThat (path ("second.third" ).getRequiredLeafEntity ()).isEqualTo (thirdEntity );
88
+ softly .assertThat (path ("secondList" ).getRequiredLeafEntity ()).isEqualTo (secondEntity );
89
89
90
90
softly .assertThatThrownBy (() -> path ("secondList.third.value" ).getRequiredLeafEntity ())
91
91
.isInstanceOf (IllegalStateException .class );
@@ -96,17 +96,16 @@ void getRequiredLeafEntity() {
96
96
@ Test // GH-1525
97
97
void idDefiningPath () {
98
98
99
- assertSoftly (softly -> {
99
+ AggregatePathSoftAssertions . assertAggregatePathsSoftly (softly -> {
100
100
101
- softly .assertThat ((Object ) path ("second.third2.value" ).getIdDefiningParentPath ()).isEqualTo (path ());
102
- softly .assertThat ((Object ) path ("second.third.value" ).getIdDefiningParentPath ()).isEqualTo (path ());
103
- softly .assertThat ((Object ) path ("secondList.third2.value" ).getIdDefiningParentPath ()).isEqualTo (path ());
104
- softly .assertThat ((Object ) path ("secondList.third.value" ).getIdDefiningParentPath ()).isEqualTo (path ());
105
- softly .assertThat ((Object ) path ("second2.third2.value" ).getIdDefiningParentPath ()).isEqualTo (path ());
106
- softly .assertThat ((Object ) path ("second2.third.value" ).getIdDefiningParentPath ()).isEqualTo (path ());
107
- softly .assertThat ((Object ) path ("withId.second.third2.value" ).getIdDefiningParentPath ())
108
- .isEqualTo (path ("withId" ));
109
- softly .assertThat ((Object ) path ("withId.second.third.value" ).getIdDefiningParentPath ()).isEqualTo (path ("withId" ));
101
+ softly .assertAggregatePath (path ("second.third2.value" ).getIdDefiningParentPath ()).isRoot ();
102
+ softly .assertAggregatePath (path ("second.third.value" ).getIdDefiningParentPath ()).isRoot ();
103
+ softly .assertAggregatePath (path ("secondList.third2.value" ).getIdDefiningParentPath ()).isRoot ();
104
+ softly .assertAggregatePath (path ("secondList.third.value" ).getIdDefiningParentPath ()).isRoot ();
105
+ softly .assertAggregatePath (path ("second2.third2.value" ).getIdDefiningParentPath ()).isRoot ();
106
+ softly .assertAggregatePath (path ("second2.third.value" ).getIdDefiningParentPath ()).isRoot ();
107
+ softly .assertAggregatePath (path ("withId.second.third2.value" ).getIdDefiningParentPath ()).hasPath ("withId" );
108
+ softly .assertAggregatePath (path ("withId.second.third.value" ).getIdDefiningParentPath ()).hasPath ("withId" );
110
109
});
111
110
}
112
111
@@ -187,13 +186,11 @@ void getQualifierColumnType() {
187
186
188
187
@ Test // GH-1525
189
188
void extendBy () {
189
+ AggregatePathSoftAssertions .assertAggregatePathsSoftly (softly -> {
190
190
191
- assertSoftly (softly -> {
192
-
193
- softly .assertThat ((Object ) path ().append (entity .getRequiredPersistentProperty ("withId" )))
194
- .isEqualTo (path ("withId" ));
195
- softly .assertThat ((Object ) path ("withId" ).append (path ("withId" ).getRequiredIdProperty ()))
196
- .isEqualTo (path ("withId.withIdId" ));
191
+ softly .assertAggregatePath (path ().append (entity .getRequiredPersistentProperty ("withId" ))).hasPath ("withId" );
192
+ softly .assertAggregatePath (path ("withId" ).append (path ("withId" ).getRequiredIdProperty ()))
193
+ .hasPath ("withId.withIdId" );
197
194
});
198
195
}
199
196
@@ -248,11 +245,11 @@ void isMultiValued() {
248
245
softly .assertThat (path ("second" ).isMultiValued ()).isFalse ();
249
246
softly .assertThat (path ("second.third2" ).isMultiValued ()).isFalse ();
250
247
softly .assertThat (path ("secondList.third2" ).isMultiValued ()).isTrue (); // this seems wrong as third2 is an
248
+
251
249
// embedded path into Second, held by
252
250
// List<Second> (so the parent is
253
251
// multi-valued but not third2).
254
- // TODO: This test fails because MultiValued considers parents.
255
- // softly.assertThat(path("secondList.third.value").isMultiValued()).isFalse();
252
+ softly .assertThat (path ("secondList.third.value" ).isMultiValued ()).isTrue ();
256
253
softly .assertThat (path ("secondList" ).isMultiValued ()).isTrue ();
257
254
});
258
255
}
@@ -457,8 +454,7 @@ void getRequiredPersistentPropertyPath() {
457
454
});
458
455
}
459
456
460
- @ Test
461
- // GH-1525
457
+ @ Test // GH-1525
462
458
void getLength () {
463
459
464
460
assertSoftly (softly -> {
@@ -476,25 +472,24 @@ void getLength() {
476
472
@ Test // GH-574
477
473
void getTail () {
478
474
479
- assertSoftly (softly -> {
475
+ AggregatePathSoftAssertions . assertAggregatePathsSoftly (softly -> {
480
476
481
- softly .assertThat (( Object ) path ().getTail ()).isEqualTo ( null );
482
- softly .assertThat (( Object ) path ("second" ).getTail ()).isEqualTo ( null );
483
- softly .assertThat (path ("second.third" ).getTail (). toDotPath ()). isEqualTo ("third" );
484
- softly .assertThat (path ("second.third.value" ).getTail (). toDotPath ()). isEqualTo ("third.value" );
477
+ softly .assertAggregatePath ( path ().getTail ()).isNull ( );
478
+ softly .assertAggregatePath ( path ("second" ).getTail ()).isNull ( );
479
+ softly .assertAggregatePath (path ("second.third" ).getTail ()). hasPath ("third" );
480
+ softly .assertAggregatePath (path ("second.third.value" ).getTail ()). hasPath ("third.value" );
485
481
});
486
482
}
487
483
488
484
@ Test // GH-74
489
485
void append () {
490
486
491
- assertSoftly (softly -> {
492
- // assert that( .... ) matches ("second")
493
- softly .assertThat (path ("second" ).append (path ()).toDotPath ()).isEqualTo ("second" );
494
- softly .assertThat (path ().append (path ("second" )).toDotPath ()).isEqualTo ("second" );
495
- softly .assertThat (path ().append (path ("second.third" )).toDotPath ()).isEqualTo ("second.third" );
487
+ AggregatePathSoftAssertions .assertAggregatePathsSoftly (softly -> {
488
+ softly .assertAggregatePath (path ("second" ).append (path ())).hasPath ("second" );
489
+ softly .assertAggregatePath (path ().append (path ("second" ))).hasPath ("second" );
490
+ softly .assertAggregatePath (path ().append (path ("second.third" ))).hasPath ("second.third" );
496
491
AggregatePath value = path ("second.third.value" ).getTail ().getTail ();
497
- softly .assertThat (path ("second.third" ).append (value ). toDotPath ()). isEqualTo ("second.third.value" );
492
+ softly .assertAggregatePath (path ("second.third" ).append (value )). hasPath ("second.third.value" );
498
493
});
499
494
}
500
495
0 commit comments