22
22
import java .util .stream .Collectors ;
23
23
24
24
import org .junit .jupiter .api .Test ;
25
-
26
25
import org .springframework .data .r2dbc .convert .MappingR2dbcConverter ;
27
26
import org .springframework .data .r2dbc .convert .R2dbcConverter ;
28
27
import org .springframework .data .r2dbc .dialect .PostgresDialect ;
@@ -102,7 +101,8 @@ void shouldMapMultipleFields() {
102
101
103
102
BoundAssignments mapped = map (update );
104
103
105
- Map <SqlIdentifier , Expression > assignments = mapped .getAssignments ().stream ().map (it -> (AssignValue ) it )
104
+ Map <SqlIdentifier , Expression > assignments = mapped .getAssignments ().stream () //
105
+ .map (it -> (AssignValue ) it ) //
106
106
.collect (Collectors .toMap (k -> k .getColumn ().getName (), AssignValue ::getValue ));
107
107
108
108
assertThat (update .getAssignments ()).hasSize (3 );
@@ -117,11 +117,15 @@ void shouldMapPathToEmbeddable() {
117
117
118
118
BoundAssignments mapped = map (update , WithEmbeddable .class );
119
119
120
- Map <SqlIdentifier , Expression > assignments = mapped .getAssignments ().stream ().map (it -> (AssignValue ) it )
120
+ Map <SqlIdentifier , Expression > assignments = mapped .getAssignments ().stream () //
121
+ .map (it -> (AssignValue ) it ) //
121
122
.collect (Collectors .toMap (k -> k .getColumn ().getName (), AssignValue ::getValue ));
122
123
123
- assertThat (assignments ).hasSize (2 ).containsEntry (SqlIdentifier .unquoted ("home_country_name" ), SQL .bindMarker ("$1" ))
124
- .containsEntry (SqlIdentifier .unquoted ("home_street" ), SQL .bindMarker ("$2" ));
124
+ assertThat (assignments ).containsExactlyInAnyOrderEntriesOf ( //
125
+ Map .of ( //
126
+ SqlIdentifier .unquoted ("home_country_name" ), SQL .bindMarker ("$1" ), //
127
+ SqlIdentifier .unquoted ("home_street" ), SQL .bindMarker ("$2" )//
128
+ ));
125
129
126
130
mapped .getBindings ().forEach (it -> {
127
131
assertThat (it .getValue ()).isIn ("DE" , "foo" );
@@ -135,10 +139,14 @@ void shouldMapPathToNestedEmbeddable() {
135
139
136
140
BoundAssignments mapped = map (update , WithEmbeddable .class );
137
141
138
- Map <SqlIdentifier , Expression > assignments = mapped .getAssignments ().stream ().map (it -> (AssignValue ) it )
142
+ Map <SqlIdentifier , Expression > assignments = mapped .getAssignments ().stream () //
143
+ .map (it -> (AssignValue ) it ) //
139
144
.collect (Collectors .toMap (k -> k .getColumn ().getName (), AssignValue ::getValue ));
140
145
141
- assertThat (assignments ).hasSize (1 ).containsEntry (SqlIdentifier .unquoted ("home_country_name" ), SQL .bindMarker ("$1" ));
146
+ assertThat (assignments ) //
147
+ .hasSize (1 ) //
148
+ .containsEntry (SqlIdentifier .unquoted ("home_country_name" ), SQL .bindMarker ("$1" ));
149
+
142
150
mapped .getBindings ().forEach (it -> {
143
151
assertThat (it .getValue ()).isEqualTo ("DE" );
144
152
});
@@ -151,10 +159,14 @@ void shouldMapPathIntoEmbeddable() {
151
159
152
160
BoundAssignments mapped = map (update , WithEmbeddable .class );
153
161
154
- Map <SqlIdentifier , Expression > assignments = mapped .getAssignments ().stream ().map (it -> (AssignValue ) it )
162
+ Map <SqlIdentifier , Expression > assignments = mapped .getAssignments ().stream ()//
163
+ .map (it -> (AssignValue ) it ) //
155
164
.collect (Collectors .toMap (k -> k .getColumn ().getName (), AssignValue ::getValue ));
156
165
157
- assertThat (assignments ).hasSize (1 ).containsEntry (SqlIdentifier .unquoted ("home_country_name" ), SQL .bindMarker ("$1" ));
166
+ assertThat (assignments ) //
167
+ .hasSize (1 ) //
168
+ .containsEntry (SqlIdentifier .unquoted ("home_country_name" ), SQL .bindMarker ("$1" ));
169
+
158
170
mapped .getBindings ().forEach (it -> {
159
171
assertThat (it .getValue ()).isEqualTo ("DE" );
160
172
});
0 commit comments