@@ -59,17 +59,13 @@ public class JdbcAggregateTemplateUnitTests {
59
59
60
60
JdbcAggregateTemplate template ;
61
61
62
- @ Mock
63
- DataAccessStrategy dataAccessStrategy ;
64
- @ Mock
65
- ApplicationEventPublisher eventPublisher ;
66
- @ Mock
67
- RelationResolver relationResolver ;
68
- @ Mock
69
- EntityCallbacks callbacks ;
62
+ @ Mock DataAccessStrategy dataAccessStrategy ;
63
+ @ Mock ApplicationEventPublisher eventPublisher ;
64
+ @ Mock RelationResolver relationResolver ;
65
+ @ Mock EntityCallbacks callbacks ;
70
66
71
67
@ BeforeEach
72
- public void setUp () {
68
+ void setUp () {
73
69
74
70
RelationalMappingContext mappingContext = new RelationalMappingContext ();
75
71
JdbcConverter converter = new MappingJdbcConverter (mappingContext , relationResolver );
@@ -80,24 +76,24 @@ public void setUp() {
80
76
}
81
77
82
78
@ Test // DATAJDBC-378
83
- public void findAllByIdMustNotAcceptNullArgumentForType () {
79
+ void findAllByIdMustNotAcceptNullArgumentForType () {
84
80
assertThatThrownBy (() -> template .findAllById (singleton (23L ), null )).isInstanceOf (IllegalArgumentException .class );
85
81
}
86
82
87
83
@ Test // DATAJDBC-378
88
- public void findAllByIdMustNotAcceptNullArgumentForIds () {
84
+ void findAllByIdMustNotAcceptNullArgumentForIds () {
89
85
90
86
assertThatThrownBy (() -> template .findAllById (null , SampleEntity .class ))
91
87
.isInstanceOf (IllegalArgumentException .class );
92
88
}
93
89
94
90
@ Test // DATAJDBC-378
95
- public void findAllByIdWithEmptyListMustReturnEmptyResult () {
91
+ void findAllByIdWithEmptyListMustReturnEmptyResult () {
96
92
assertThat (template .findAllById (emptyList (), SampleEntity .class )).isEmpty ();
97
93
}
98
94
99
95
@ Test // DATAJDBC-393, GH-1291
100
- public void callbackOnSave () {
96
+ void callbackOnSave () {
101
97
102
98
SampleEntity first = new SampleEntity (null , "Alfred" );
103
99
SampleEntity second = new SampleEntity (23L , "Alfred E." );
@@ -115,7 +111,7 @@ public void callbackOnSave() {
115
111
}
116
112
117
113
@ Test // GH-1291
118
- public void doesNotEmitEvents () {
114
+ void doesNotEmitEvents () {
119
115
120
116
SampleEntity first = new SampleEntity (null , "Alfred" );
121
117
SampleEntity second = new SampleEntity (23L , "Alfred E." );
@@ -129,8 +125,7 @@ public void doesNotEmitEvents() {
129
125
verifyNoInteractions (eventPublisher );
130
126
}
131
127
132
- @ Test
133
- // GH-1137
128
+ @ Test // GH-1137
134
129
void savePreparesInstanceWithInitialVersion_onInsert () {
135
130
136
131
EntityWithVersion entity = new EntityWithVersion (1L );
@@ -145,8 +140,7 @@ void savePreparesInstanceWithInitialVersion_onInsert() {
145
140
assertThat (afterConvert .getVersion ()).isEqualTo (0L );
146
141
}
147
142
148
- @ Test
149
- // GH-1137
143
+ @ Test // GH-1137
150
144
void savePreparesInstanceWithInitialVersion_onInsert_whenVersionPropertyIsImmutable () {
151
145
152
146
EntityWithImmutableVersion entity = new EntityWithImmutableVersion (1L , null );
@@ -161,8 +155,7 @@ void savePreparesInstanceWithInitialVersion_onInsert_whenVersionPropertyIsImmuta
161
155
assertThat (afterConvert .getVersion ()).isEqualTo (0L );
162
156
}
163
157
164
- @ Test
165
- // GH-1137
158
+ @ Test // GH-1137
166
159
void savePreparesInstanceWithInitialVersion_onInsert_whenVersionPropertyIsPrimitiveType () {
167
160
168
161
EntityWithPrimitiveVersion entity = new EntityWithPrimitiveVersion (1L );
@@ -177,8 +170,7 @@ void savePreparesInstanceWithInitialVersion_onInsert_whenVersionPropertyIsPrimit
177
170
assertThat (afterConvert .getVersion ()).isEqualTo (1L );
178
171
}
179
172
180
- @ Test
181
- // GH-1137
173
+ @ Test // GH-1137
182
174
void savePreparesInstanceWithInitialVersion_onInsert__whenVersionPropertyIsImmutableAndPrimitiveType () {
183
175
184
176
EntityWithImmutablePrimitiveVersion entity = new EntityWithImmutablePrimitiveVersion (1L , 0L );
@@ -194,8 +186,7 @@ void savePreparesInstanceWithInitialVersion_onInsert__whenVersionPropertyIsImmut
194
186
assertThat (afterConvert .getVersion ()).isEqualTo (1L );
195
187
}
196
188
197
- @ Test
198
- // GH-1137
189
+ @ Test // GH-1137
199
190
void savePreparesChangeWithPreviousVersion_onUpdate () {
200
191
201
192
when (dataAccessStrategy .updateWithVersion (any (), any (), any ())).thenReturn (true );
@@ -212,8 +203,7 @@ void savePreparesChangeWithPreviousVersion_onUpdate() {
212
203
assertThat (aggregateChange .getPreviousVersion ()).isEqualTo (1L );
213
204
}
214
205
215
- @ Test
216
- // GH-1137
206
+ @ Test // GH-1137
217
207
void savePreparesInstanceWithNextVersion_onUpdate () {
218
208
219
209
when (dataAccessStrategy .updateWithVersion (any (), any (), any ())).thenReturn (true );
@@ -230,8 +220,7 @@ void savePreparesInstanceWithNextVersion_onUpdate() {
230
220
assertThat (afterConvert .getVersion ()).isEqualTo (2L );
231
221
}
232
222
233
- @ Test
234
- // GH-1137
223
+ @ Test // GH-1137
235
224
void savePreparesInstanceWithNextVersion_onUpdate_whenVersionPropertyIsImmutable () {
236
225
237
226
when (dataAccessStrategy .updateWithVersion (any (), any (), any ())).thenReturn (true );
@@ -246,8 +235,7 @@ void savePreparesInstanceWithNextVersion_onUpdate_whenVersionPropertyIsImmutable
246
235
assertThat (afterConvert .getVersion ()).isEqualTo (2L );
247
236
}
248
237
249
- @ Test
250
- // GH-1137
238
+ @ Test // GH-1137
251
239
void deletePreparesChangeWithPreviousVersion_onDeleteByInstance () {
252
240
253
241
EntityWithImmutableVersion entity = new EntityWithImmutableVersion (1L , 1L );
@@ -263,7 +251,7 @@ void deletePreparesChangeWithPreviousVersion_onDeleteByInstance() {
263
251
}
264
252
265
253
@ Test // DATAJDBC-393
266
- public void callbackOnDelete () {
254
+ void callbackOnDelete () {
267
255
268
256
SampleEntity first = new SampleEntity (23L , "Alfred" );
269
257
SampleEntity second = new SampleEntity (23L , "Alfred E." );
@@ -277,7 +265,7 @@ public void callbackOnDelete() {
277
265
}
278
266
279
267
@ Test // DATAJDBC-101
280
- public void callbackOnLoadSorted () {
268
+ void callbackOnLoadSorted () {
281
269
282
270
SampleEntity alfred1 = new SampleEntity (23L , "Alfred" );
283
271
SampleEntity alfred2 = new SampleEntity (23L , "Alfred E." );
@@ -299,7 +287,7 @@ public void callbackOnLoadSorted() {
299
287
}
300
288
301
289
@ Test // DATAJDBC-101
302
- public void callbackOnLoadPaged () {
290
+ void callbackOnLoadPaged () {
303
291
304
292
SampleEntity alfred1 = new SampleEntity (23L , "Alfred" );
305
293
SampleEntity alfred2 = new SampleEntity (23L , "Alfred E." );
@@ -321,35 +309,34 @@ public void callbackOnLoadPaged() {
321
309
}
322
310
323
311
@ Test // GH-1401
324
- public void saveAllWithEmptyListDoesNothing () {
312
+ void saveAllWithEmptyListDoesNothing () {
325
313
assertThat (template .saveAll (emptyList ())).isEmpty ();
326
314
}
327
315
328
316
@ Test // GH-1401
329
- public void insertAllWithEmptyListDoesNothing () {
317
+ void insertAllWithEmptyListDoesNothing () {
330
318
assertThat (template .insertAll (emptyList ())).isEmpty ();
331
319
}
332
320
333
321
@ Test // GH-1401
334
- public void updateAllWithEmptyListDoesNothing () {
322
+ void updateAllWithEmptyListDoesNothing () {
335
323
assertThat (template .updateAll (emptyList ())).isEmpty ();
336
324
}
337
325
338
326
@ Test // GH-1401
339
- public void deleteAllWithEmptyListDoesNothing () {
327
+ void deleteAllWithEmptyListDoesNothing () {
340
328
template .deleteAll (emptyList ());
341
329
}
342
330
343
331
@ Test // GH-1401
344
- public void deleteAllByIdWithEmptyListDoesNothing () {
332
+ void deleteAllByIdWithEmptyListDoesNothing () {
345
333
template .deleteAllById (emptyList (), SampleEntity .class );
346
334
}
347
335
348
336
private static class SampleEntity {
349
337
350
338
@ Column ("id1" )
351
- @ Id
352
- private Long id ;
339
+ @ Id private Long id ;
353
340
354
341
private String name ;
355
342
@@ -366,23 +353,21 @@ public String getName() {
366
353
return this .name ;
367
354
}
368
355
369
- public void setId (Long id ) {
356
+ void setId (Long id ) {
370
357
this .id = id ;
371
358
}
372
359
373
- public void setName (String name ) {
360
+ void setName (String name ) {
374
361
this .name = name ;
375
362
}
376
363
}
377
364
378
365
private static class EntityWithVersion {
379
366
380
367
@ Column ("id1" )
381
- @ Id
382
- private final Long id ;
368
+ @ Id private final Long id ;
383
369
384
- @ Version
385
- private Long version ;
370
+ @ Version private Long version ;
386
371
387
372
public EntityWithVersion (Long id ) {
388
373
this .id = id ;
@@ -396,19 +381,17 @@ public Long getVersion() {
396
381
return this .version ;
397
382
}
398
383
399
- public void setVersion (Long version ) {
384
+ void setVersion (Long version ) {
400
385
this .version = version ;
401
386
}
402
387
}
403
388
404
389
private static class EntityWithImmutableVersion {
405
390
406
391
@ Column ("id1" )
407
- @ Id
408
- private final Long id ;
392
+ @ Id private final Long id ;
409
393
410
- @ Version
411
- private final Long version ;
394
+ @ Version private final Long version ;
412
395
413
396
public EntityWithImmutableVersion (Long id , Long version ) {
414
397
this .id = id ;
@@ -427,11 +410,9 @@ public Long getVersion() {
427
410
private static class EntityWithPrimitiveVersion {
428
411
429
412
@ Column ("id1" )
430
- @ Id
431
- private final Long id ;
413
+ @ Id private final Long id ;
432
414
433
- @ Version
434
- private long version ;
415
+ @ Version private long version ;
435
416
436
417
public EntityWithPrimitiveVersion (Long id ) {
437
418
this .id = id ;
@@ -445,19 +426,17 @@ public long getVersion() {
445
426
return this .version ;
446
427
}
447
428
448
- public void setVersion (long version ) {
429
+ void setVersion (long version ) {
449
430
this .version = version ;
450
431
}
451
432
}
452
433
453
434
private static class EntityWithImmutablePrimitiveVersion {
454
435
455
436
@ Column ("id1" )
456
- @ Id
457
- private final Long id ;
437
+ @ Id private final Long id ;
458
438
459
- @ Version
460
- private final long version ;
439
+ @ Version private final long version ;
461
440
462
441
public EntityWithImmutablePrimitiveVersion (Long id , long version ) {
463
442
this .id = id ;
0 commit comments