Skip to content

Commit 690c693

Browse files
committed
Polishing.
See #557
1 parent 5a024fb commit 690c693

File tree

2 files changed

+44
-44
lines changed

2 files changed

+44
-44
lines changed

src/test/java/org/springframework/data/r2dbc/convert/MappingR2dbcConverterUnitTests.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@
5656
*/
5757
public class MappingR2dbcConverterUnitTests {
5858

59-
RelationalMappingContext mappingContext = new R2dbcMappingContext();
60-
MappingR2dbcConverter converter = new MappingR2dbcConverter(mappingContext);
59+
private RelationalMappingContext mappingContext = new R2dbcMappingContext();
60+
private MappingR2dbcConverter converter = new MappingR2dbcConverter(mappingContext);
6161

6262
@BeforeEach
63-
public void before() {
63+
void before() {
6464

6565
R2dbcCustomConversions conversions = new R2dbcCustomConversions(
6666
Arrays.asList(StringToMapConverter.INSTANCE, MapToStringConverter.INSTANCE,
@@ -72,7 +72,7 @@ public void before() {
7272
}
7373

7474
@Test // gh-61, gh-207
75-
public void shouldIncludeAllPropertiesInOutboundRow() {
75+
void shouldIncludeAllPropertiesInOutboundRow() {
7676

7777
OutboundRow row = new OutboundRow();
7878

@@ -89,7 +89,7 @@ public void shouldIncludeAllPropertiesInOutboundRow() {
8989
}
9090

9191
@Test // gh-41
92-
public void shouldPassThroughRow() {
92+
void shouldPassThroughRow() {
9393

9494
Row rowMock = mock(Row.class);
9595

@@ -99,7 +99,7 @@ public void shouldPassThroughRow() {
9999
}
100100

101101
@Test // gh-41
102-
public void shouldConvertRowToNumber() {
102+
void shouldConvertRowToNumber() {
103103

104104
Row rowMock = mock(Row.class);
105105
when(rowMock.get(0)).thenReturn(42);
@@ -110,7 +110,7 @@ public void shouldConvertRowToNumber() {
110110
}
111111

112112
@Test // gh-59
113-
public void shouldFailOnUnsupportedEntity() {
113+
void shouldFailOnUnsupportedEntity() {
114114

115115
PersonWithConversions withMap = new PersonWithConversions(null, null, new NonMappableEntity());
116116
OutboundRow row = new OutboundRow();
@@ -119,7 +119,7 @@ public void shouldFailOnUnsupportedEntity() {
119119
}
120120

121121
@Test // gh-59
122-
public void shouldConvertMapToString() {
122+
void shouldConvertMapToString() {
123123

124124
PersonWithConversions withMap = new PersonWithConversions("foo", Collections.singletonMap("map", "value"), null);
125125
OutboundRow row = new OutboundRow();
@@ -129,7 +129,7 @@ public void shouldConvertMapToString() {
129129
}
130130

131131
@Test // gh-59
132-
public void shouldReadMapFromString() {
132+
void shouldReadMapFromString() {
133133

134134
Row rowMock = mock(Row.class);
135135
when(rowMock.get("nested")).thenReturn("map");
@@ -140,7 +140,7 @@ public void shouldReadMapFromString() {
140140
}
141141

142142
@Test // gh-59
143-
public void shouldConvertEnum() {
143+
void shouldConvertEnum() {
144144

145145
WithEnum withMap = new WithEnum("foo", Condition.Mint);
146146
OutboundRow row = new OutboundRow();
@@ -150,7 +150,7 @@ public void shouldConvertEnum() {
150150
}
151151

152152
@Test // gh-59
153-
public void shouldConvertNullEnum() {
153+
void shouldConvertNullEnum() {
154154

155155
WithEnum withMap = new WithEnum("foo", null);
156156
OutboundRow row = new OutboundRow();
@@ -160,7 +160,7 @@ public void shouldConvertNullEnum() {
160160
}
161161

162162
@Test // gh-59
163-
public void shouldReadEnum() {
163+
void shouldReadEnum() {
164164

165165
Row rowMock = mock(Row.class);
166166
when(rowMock.get("condition")).thenReturn("Mint");
@@ -171,7 +171,7 @@ public void shouldReadEnum() {
171171
}
172172

173173
@Test // gh-59
174-
public void shouldWriteTopLevelEntity() {
174+
void shouldWriteTopLevelEntity() {
175175

176176
CustomConversionPerson person = new CustomConversionPerson();
177177
person.entity = new NonMappableEntity();
@@ -185,7 +185,7 @@ public void shouldWriteTopLevelEntity() {
185185
}
186186

187187
@Test // gh-530
188-
public void shouldReadTopLevelEntity() {
188+
void shouldReadTopLevelEntity() {
189189

190190
mappingContext.setForceQuote(true);
191191

@@ -200,7 +200,7 @@ public void shouldReadTopLevelEntity() {
200200
}
201201

202202
@Test // gh-59
203-
public void shouldReadTopLevelEntityWithConverter() {
203+
void shouldReadTopLevelEntityWithConverter() {
204204

205205
Row rowMock = mock(Row.class);
206206
when(rowMock.get("foo_column", String.class)).thenReturn("bar");
@@ -213,7 +213,7 @@ public void shouldReadTopLevelEntityWithConverter() {
213213
}
214214

215215
@Test // gh-402
216-
public void writeShouldWritePrimitiveIdIfValueIsNonZero() {
216+
void writeShouldWritePrimitiveIdIfValueIsNonZero() {
217217

218218
OutboundRow row = new OutboundRow();
219219
converter.write(new WithPrimitiveId(1), row);
@@ -222,7 +222,7 @@ public void writeShouldWritePrimitiveIdIfValueIsNonZero() {
222222
}
223223

224224
@Test // gh-59
225-
public void shouldEvaluateSpelExpression() {
225+
void shouldEvaluateSpelExpression() {
226226

227227
MockRow row = MockRow.builder().identified("id", Object.class, 42).identified("world", Object.class, "No, universe")
228228
.build();
@@ -281,7 +281,7 @@ static class CustomConversionPerson {
281281
NonMappableEntity entity;
282282
}
283283

284-
static class NonMappableEntity {}
284+
private static class NonMappableEntity {}
285285

286286
@ReadingConverter
287287
enum StringToMapConverter implements Converter<String, Map<String, String>> {

src/test/java/org/springframework/data/r2dbc/core/R2dbcEntityTemplateUnitTests.java

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@
7070
*/
7171
public class R2dbcEntityTemplateUnitTests {
7272

73-
org.springframework.r2dbc.core.DatabaseClient client;
74-
R2dbcEntityTemplate entityTemplate;
75-
StatementRecorder recorder;
73+
private org.springframework.r2dbc.core.DatabaseClient client;
74+
private R2dbcEntityTemplate entityTemplate;
75+
private StatementRecorder recorder;
7676

7777
@BeforeEach
78-
public void before() {
78+
void before() {
7979

8080
recorder = StatementRecorder.newInstance();
8181
client = DatabaseClient.builder().connectionFactory(recorder)
@@ -84,7 +84,7 @@ public void before() {
8484
}
8585

8686
@Test // gh-220
87-
public void shouldCountBy() {
87+
void shouldCountBy() {
8888

8989
MockRowMetadata metadata = MockRowMetadata.builder()
9090
.columnMetadata(MockColumnMetadata.builder().name("name").build()).build();
@@ -105,7 +105,7 @@ public void shouldCountBy() {
105105
}
106106

107107
@Test // gh-469
108-
public void shouldProjectExistsResult() {
108+
void shouldProjectExistsResult() {
109109

110110
MockRowMetadata metadata = MockRowMetadata.builder()
111111
.columnMetadata(MockColumnMetadata.builder().name("name").build()).build();
@@ -123,7 +123,7 @@ public void shouldProjectExistsResult() {
123123
}
124124

125125
@Test // gh-469
126-
public void shouldExistsByCriteria() {
126+
void shouldExistsByCriteria() {
127127

128128
MockRowMetadata metadata = MockRowMetadata.builder()
129129
.columnMetadata(MockColumnMetadata.builder().name("name").build()).build();
@@ -144,7 +144,7 @@ public void shouldExistsByCriteria() {
144144
}
145145

146146
@Test // gh-220
147-
public void shouldSelectByCriteria() {
147+
void shouldSelectByCriteria() {
148148

149149
recorder.addStubbing(s -> s.startsWith("SELECT"), Collections.emptyList());
150150

@@ -160,7 +160,7 @@ public void shouldSelectByCriteria() {
160160
}
161161

162162
@Test // gh-215
163-
public void selectShouldInvokeCallback() {
163+
void selectShouldInvokeCallback() {
164164

165165
MockRowMetadata metadata = MockRowMetadata.builder().columnMetadata(MockColumnMetadata.builder().name("id").build())
166166
.columnMetadata(MockColumnMetadata.builder().name("THE_NAME").build()).build();
@@ -185,7 +185,7 @@ public void selectShouldInvokeCallback() {
185185
}
186186

187187
@Test // gh-220
188-
public void shouldSelectOne() {
188+
void shouldSelectOne() {
189189

190190
recorder.addStubbing(s -> s.startsWith("SELECT"), Collections.emptyList());
191191

@@ -201,7 +201,7 @@ public void shouldSelectOne() {
201201
}
202202

203203
@Test // gh-220
204-
public void shouldUpdateByQuery() {
204+
void shouldUpdateByQuery() {
205205

206206
MockRowMetadata metadata = MockRowMetadata.builder()
207207
.columnMetadata(MockColumnMetadata.builder().name("name").build()).build();
@@ -223,7 +223,7 @@ public void shouldUpdateByQuery() {
223223
}
224224

225225
@Test // gh-220
226-
public void shouldDeleteByQuery() {
226+
void shouldDeleteByQuery() {
227227

228228
MockRowMetadata metadata = MockRowMetadata.builder()
229229
.columnMetadata(MockColumnMetadata.builder().name("name").build()).build();
@@ -243,7 +243,7 @@ public void shouldDeleteByQuery() {
243243
}
244244

245245
@Test // gh-220
246-
public void shouldDeleteEntity() {
246+
void shouldDeleteEntity() {
247247

248248
Person person = new Person();
249249
person.id = "Walter";
@@ -260,7 +260,7 @@ public void shouldDeleteEntity() {
260260
}
261261

262262
@Test // gh-365
263-
public void shouldInsertVersioned() {
263+
void shouldInsertVersioned() {
264264

265265
MockRowMetadata metadata = MockRowMetadata.builder().build();
266266
MockResult result = MockResult.builder().rowMetadata(metadata).rowsUpdated(1).build();
@@ -281,7 +281,7 @@ public void shouldInsertVersioned() {
281281
}
282282

283283
@Test // gh-557, gh-402
284-
public void shouldSkipDefaultIdValueOnInsert() {
284+
void shouldSkipDefaultIdValueOnInsert() {
285285

286286
MockRowMetadata metadata = MockRowMetadata.builder().build();
287287
MockResult result = MockResult.builder().rowMetadata(metadata).rowsUpdated(1).build();
@@ -299,7 +299,7 @@ public void shouldSkipDefaultIdValueOnInsert() {
299299
}
300300

301301
@Test // gh-557, gh-402
302-
public void shouldSkipDefaultIdValueOnVersionedInsert() {
302+
void shouldSkipDefaultIdValueOnVersionedInsert() {
303303

304304
MockRowMetadata metadata = MockRowMetadata.builder().build();
305305
MockResult result = MockResult.builder().rowMetadata(metadata).rowsUpdated(1).build();
@@ -321,7 +321,7 @@ public void shouldSkipDefaultIdValueOnVersionedInsert() {
321321
}
322322

323323
@Test // gh-451
324-
public void shouldInsertCorrectlyVersionedAndAudited() {
324+
void shouldInsertCorrectlyVersionedAndAudited() {
325325

326326
MockRowMetadata metadata = MockRowMetadata.builder().build();
327327
MockResult result = MockResult.builder().rowMetadata(metadata).rowsUpdated(1).build();
@@ -349,7 +349,7 @@ public void shouldInsertCorrectlyVersionedAndAudited() {
349349
}
350350

351351
@Test // gh-451
352-
public void shouldUpdateCorrectlyVersionedAndAudited() {
352+
void shouldUpdateCorrectlyVersionedAndAudited() {
353353

354354
MockRowMetadata metadata = MockRowMetadata.builder().build();
355355
MockResult result = MockResult.builder().rowMetadata(metadata).rowsUpdated(1).build();
@@ -378,7 +378,7 @@ public void shouldUpdateCorrectlyVersionedAndAudited() {
378378
}
379379

380380
@Test // gh-215
381-
public void insertShouldInvokeCallback() {
381+
void insertShouldInvokeCallback() {
382382

383383
MockRowMetadata metadata = MockRowMetadata.builder().build();
384384
MockResult result = MockResult.builder().rowMetadata(metadata).rowsUpdated(1).build();
@@ -406,7 +406,7 @@ public void insertShouldInvokeCallback() {
406406
}
407407

408408
@Test // gh-365
409-
public void shouldUpdateVersioned() {
409+
void shouldUpdateVersioned() {
410410

411411
MockRowMetadata metadata = MockRowMetadata.builder().build();
412412
MockResult result = MockResult.builder().rowMetadata(metadata).rowsUpdated(1).build();
@@ -428,7 +428,7 @@ public void shouldUpdateVersioned() {
428428
}
429429

430430
@Test // gh-215
431-
public void updateShouldInvokeCallback() {
431+
void updateShouldInvokeCallback() {
432432

433433
MockRowMetadata metadata = MockRowMetadata.builder().build();
434434
MockResult result = MockResult.builder().rowMetadata(metadata).rowsUpdated(1).build();
@@ -480,7 +480,7 @@ public void setName(String name) {
480480

481481
@Value
482482
@With
483-
static class VersionedPerson {
483+
private static class VersionedPerson {
484484

485485
@Id String id;
486486

@@ -491,7 +491,7 @@ static class VersionedPerson {
491491

492492
@Value
493493
@With
494-
static class PersonWithPrimitiveId {
494+
private static class PersonWithPrimitiveId {
495495

496496
@Id int id;
497497

@@ -500,7 +500,7 @@ static class PersonWithPrimitiveId {
500500

501501
@Value
502502
@With
503-
static class VersionedPersonWithPrimitiveId {
503+
private static class VersionedPersonWithPrimitiveId {
504504

505505
@Id int id;
506506

@@ -511,7 +511,7 @@ static class VersionedPersonWithPrimitiveId {
511511

512512
@Value
513513
@With
514-
static class WithAuditingAndOptimisticLocking {
514+
private static class WithAuditingAndOptimisticLocking {
515515

516516
@Id String id;
517517

@@ -527,7 +527,7 @@ static class ValueCapturingEntityCallback<T> {
527527

528528
private final List<T> values = new ArrayList<>(1);
529529

530-
protected void capture(T value) {
530+
void capture(T value) {
531531
values.add(value);
532532
}
533533

0 commit comments

Comments
 (0)