15
15
*/
16
16
package org .springframework .data .relational .core .conversion ;
17
17
18
+ import static org .assertj .core .api .Assertions .*;
19
+
18
20
import lombok .Data ;
21
+ import lombok .RequiredArgsConstructor ;
19
22
20
23
import java .util .ArrayList ;
21
24
import java .util .List ;
22
25
23
- import lombok .RequiredArgsConstructor ;
24
- import org .assertj .core .api .Assertions ;
25
26
import org .assertj .core .groups .Tuple ;
26
27
import org .junit .jupiter .api .Test ;
27
28
import org .junit .jupiter .api .extension .ExtendWith ;
@@ -57,7 +58,7 @@ public void deleteDeletesTheEntityAndReferencedEntities() {
57
58
58
59
converter .write (entity .id , aggregateChange );
59
60
60
- Assertions . assertThat (extractActions (aggregateChange ))
61
+ assertThat (extractActions (aggregateChange ))
61
62
.extracting (DbAction ::getClass , DbAction ::getEntityType , DbActionTestSupport ::extractPath ) //
62
63
.containsExactly ( //
63
64
Tuple .tuple (AcquireLockRoot .class , SomeEntity .class , "" ), //
@@ -76,7 +77,7 @@ public void deleteDeletesTheEntityAndNoReferencedEntities() {
76
77
77
78
converter .write (entity .id , aggregateChange );
78
79
79
- Assertions . assertThat (extractActions (aggregateChange ))
80
+ assertThat (extractActions (aggregateChange ))
80
81
.extracting (DbAction ::getClass , DbAction ::getEntityType , DbActionTestSupport ::extractPath ) //
81
82
.containsExactly (Tuple .tuple (DeleteRoot .class , SingleEntity .class , "" ));
82
83
}
@@ -88,7 +89,7 @@ public void deleteAllDeletesAllEntitiesAndReferencedEntities() {
88
89
89
90
converter .write (null , aggregateChange );
90
91
91
- Assertions . assertThat (extractActions (aggregateChange ))
92
+ assertThat (extractActions (aggregateChange ))
92
93
.extracting (DbAction ::getClass , DbAction ::getEntityType , DbActionTestSupport ::extractPath ) //
93
94
.containsExactly ( //
94
95
Tuple .tuple (AcquireLockAllRoot .class , SomeEntity .class , "" ), //
@@ -105,7 +106,7 @@ public void deleteAllDeletesAllEntitiesAndNoReferencedEntities() {
105
106
106
107
converter .write (null , aggregateChange );
107
108
108
- Assertions . assertThat (extractActions (aggregateChange ))
109
+ assertThat (extractActions (aggregateChange ))
109
110
.extracting (DbAction ::getClass , DbAction ::getEntityType , DbActionTestSupport ::extractPath ) //
110
111
.containsExactly (Tuple .tuple (DeleteAllRoot .class , SingleEntity .class , "" ));
111
112
}
@@ -115,11 +116,12 @@ public void deleteDoesNotDeleteReadOnlyReferences() {
115
116
116
117
WithReadOnlyReference entity = new WithReadOnlyReference (23L );
117
118
118
- MutableAggregateChange <WithReadOnlyReference > aggregateChange = MutableAggregateChange .forDelete (WithReadOnlyReference .class );
119
+ MutableAggregateChange <WithReadOnlyReference > aggregateChange = MutableAggregateChange
120
+ .forDelete (WithReadOnlyReference .class );
119
121
120
122
converter .write (entity .id , aggregateChange );
121
123
122
- Assertions . assertThat (extractActions (aggregateChange ))
124
+ assertThat (extractActions (aggregateChange ))
123
125
.extracting (DbAction ::getClass , DbAction ::getEntityType , DbActionTestSupport ::extractPath ) //
124
126
.containsExactly ( //
125
127
Tuple .tuple (DeleteRoot .class , WithReadOnlyReference .class , "" ) //
@@ -131,18 +133,18 @@ public void deleteAllDoesNotDeleteReadOnlyReferences() {
131
133
132
134
WithReadOnlyReference entity = new WithReadOnlyReference (23L );
133
135
134
- MutableAggregateChange <WithReadOnlyReference > aggregateChange = MutableAggregateChange .forDelete (WithReadOnlyReference .class );
136
+ MutableAggregateChange <WithReadOnlyReference > aggregateChange = MutableAggregateChange
137
+ .forDelete (WithReadOnlyReference .class );
135
138
136
139
converter .write (null , aggregateChange );
137
140
138
- Assertions . assertThat (extractActions (aggregateChange ))
141
+ assertThat (extractActions (aggregateChange ))
139
142
.extracting (DbAction ::getClass , DbAction ::getEntityType , DbActionTestSupport ::extractPath ) //
140
143
.containsExactly ( //
141
144
Tuple .tuple (DeleteAllRoot .class , WithReadOnlyReference .class , "" ) //
142
145
);
143
146
}
144
147
145
-
146
148
private List <DbAction <?>> extractActions (MutableAggregateChange <?> aggregateChange ) {
147
149
148
150
List <DbAction <?>> actions = new ArrayList <>();
@@ -179,8 +181,8 @@ private class SingleEntity {
179
181
180
182
@ RequiredArgsConstructor
181
183
private static class WithReadOnlyReference {
184
+
182
185
@ Id final Long id ;
183
- @ ReadOnlyProperty
184
- OtherEntity other ;
186
+ @ ReadOnlyProperty OtherEntity other ;
185
187
}
186
188
}
0 commit comments