Skip to content

Commit 2841b90

Browse files
schaudermp911de
authored andcommitted
Polishing.
See #2011 Original pull request: #2114
1 parent 079c177 commit 2841b90

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

spring-data-r2dbc/src/test/java/org/springframework/data/r2dbc/query/UpdateMapperUnitTests.java

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.util.stream.Collectors;
2323

2424
import org.junit.jupiter.api.Test;
25-
2625
import org.springframework.data.r2dbc.convert.MappingR2dbcConverter;
2726
import org.springframework.data.r2dbc.convert.R2dbcConverter;
2827
import org.springframework.data.r2dbc.dialect.PostgresDialect;
@@ -102,7 +101,8 @@ void shouldMapMultipleFields() {
102101

103102
BoundAssignments mapped = map(update);
104103

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) //
106106
.collect(Collectors.toMap(k -> k.getColumn().getName(), AssignValue::getValue));
107107

108108
assertThat(update.getAssignments()).hasSize(3);
@@ -117,11 +117,15 @@ void shouldMapPathToEmbeddable() {
117117

118118
BoundAssignments mapped = map(update, WithEmbeddable.class);
119119

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) //
121122
.collect(Collectors.toMap(k -> k.getColumn().getName(), AssignValue::getValue));
122123

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+
));
125129

126130
mapped.getBindings().forEach(it -> {
127131
assertThat(it.getValue()).isIn("DE", "foo");
@@ -135,10 +139,14 @@ void shouldMapPathToNestedEmbeddable() {
135139

136140
BoundAssignments mapped = map(update, WithEmbeddable.class);
137141

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) //
139144
.collect(Collectors.toMap(k -> k.getColumn().getName(), AssignValue::getValue));
140145

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+
142150
mapped.getBindings().forEach(it -> {
143151
assertThat(it.getValue()).isEqualTo("DE");
144152
});
@@ -151,10 +159,14 @@ void shouldMapPathIntoEmbeddable() {
151159

152160
BoundAssignments mapped = map(update, WithEmbeddable.class);
153161

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) //
155164
.collect(Collectors.toMap(k -> k.getColumn().getName(), AssignValue::getValue));
156165

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+
158170
mapped.getBindings().forEach(it -> {
159171
assertThat(it.getValue()).isEqualTo("DE");
160172
});

0 commit comments

Comments
 (0)