78
78
*/
79
79
public class EntityRowMapperUnitTests {
80
80
81
- public static final long ID_FOR_ENTITY_REFERENCING_MAP = 42L ;
82
- public static final long ID_FOR_ENTITY_REFERENCING_LIST = 4711L ;
83
- public static final long ID_FOR_ENTITY_NOT_REFERENCING_MAP = 23L ;
84
- public static final NamingStrategy X_APPENDING_NAMINGSTRATEGY = new NamingStrategy () {
81
+ static final long ID_FOR_ENTITY_REFERENCING_MAP = 42L ;
82
+ static final long ID_FOR_ENTITY_REFERENCING_LIST = 4711L ;
83
+ static final long ID_FOR_ENTITY_NOT_REFERENCING_MAP = 23L ;
84
+ static final NamingStrategy X_APPENDING_NAMINGSTRATEGY = new NamingStrategy () {
85
85
@ Override
86
86
public String getColumnName (RelationalPersistentProperty property ) {
87
87
return NamingStrategy .super .getColumnName (property ).concat ("x" );
88
88
}
89
89
};
90
90
91
91
@ Test // DATAJDBC-113
92
- public void simpleEntitiesGetProperlyExtracted () throws SQLException {
92
+ void simpleEntitiesGetProperlyExtracted () throws SQLException {
93
93
94
94
ResultSet rs = mockResultSet (asList ("ID" , "NAME" ), //
95
95
ID_FOR_ENTITY_NOT_REFERENCING_MAP , "alpha" );
@@ -104,7 +104,7 @@ public void simpleEntitiesGetProperlyExtracted() throws SQLException {
104
104
}
105
105
106
106
@ Test // DATAJDBC-181
107
- public void namingStrategyGetsHonored () throws SQLException {
107
+ void namingStrategyGetsHonored () throws SQLException {
108
108
109
109
ResultSet rs = mockResultSet (asList ("IDX" , "NAMEX" ), //
110
110
ID_FOR_ENTITY_NOT_REFERENCING_MAP , "alpha" );
@@ -119,7 +119,7 @@ public void namingStrategyGetsHonored() throws SQLException {
119
119
}
120
120
121
121
@ Test // DATAJDBC-181
122
- public void namingStrategyGetsHonoredForConstructor () throws SQLException {
122
+ void namingStrategyGetsHonoredForConstructor () throws SQLException {
123
123
124
124
ResultSet rs = mockResultSet (asList ("IDX" , "NAMEX" ), //
125
125
ID_FOR_ENTITY_NOT_REFERENCING_MAP , "alpha" );
@@ -134,7 +134,7 @@ public void namingStrategyGetsHonoredForConstructor() throws SQLException {
134
134
}
135
135
136
136
@ Test // DATAJDBC-427
137
- public void simpleWithReferenceGetProperlyExtracted () throws SQLException {
137
+ void simpleWithReferenceGetProperlyExtracted () throws SQLException {
138
138
139
139
ResultSet rs = mockResultSet (asList ("ID" , "NAME" , "TRIVIAL_ID" ), //
140
140
ID_FOR_ENTITY_NOT_REFERENCING_MAP , "alpha" , 100L );
@@ -149,7 +149,7 @@ public void simpleWithReferenceGetProperlyExtracted() throws SQLException {
149
149
}
150
150
151
151
@ Test // DATAJDBC-113
152
- public void simpleOneToOneGetsProperlyExtracted () throws SQLException {
152
+ void simpleOneToOneGetsProperlyExtracted () throws SQLException {
153
153
154
154
ResultSet rs = mockResultSet (asList ("ID" , "NAME" , "CHILD_ID" , "CHILD_NAME" ), //
155
155
ID_FOR_ENTITY_NOT_REFERENCING_MAP , "alpha" , 24L , "beta" );
@@ -164,7 +164,7 @@ public void simpleOneToOneGetsProperlyExtracted() throws SQLException {
164
164
}
165
165
166
166
@ Test // DATAJDBC-286
167
- public void immutableOneToOneGetsProperlyExtracted () throws SQLException {
167
+ void immutableOneToOneGetsProperlyExtracted () throws SQLException {
168
168
169
169
ResultSet rs = mockResultSet (asList ("ID" , "NAME" , "CHILD_ID" , "CHILD_NAME" ), //
170
170
ID_FOR_ENTITY_NOT_REFERENCING_MAP , "alpha" , 24L , "beta" );
@@ -179,7 +179,7 @@ public void immutableOneToOneGetsProperlyExtracted() throws SQLException {
179
179
}
180
180
181
181
@ Test // DATAJDBC-427
182
- public void immutableWithReferenceGetsProperlyExtracted () throws SQLException {
182
+ void immutableWithReferenceGetsProperlyExtracted () throws SQLException {
183
183
184
184
ResultSet rs = mockResultSet (asList ("ID" , "NAME" , "TRIVIAL_ID" ), //
185
185
ID_FOR_ENTITY_NOT_REFERENCING_MAP , "alpha" , 100L );
@@ -195,7 +195,7 @@ public void immutableWithReferenceGetsProperlyExtracted() throws SQLException {
195
195
196
196
// TODO add additional test for multilevel embeddables
197
197
@ Test // DATAJDBC-111
198
- public void simpleEmbeddedGetsProperlyExtracted () throws SQLException {
198
+ void simpleEmbeddedGetsProperlyExtracted () throws SQLException {
199
199
200
200
ResultSet rs = mockResultSet (asList ("ID" , "NAME" , "PREFIX_ID" , "PREFIX_NAME" ), //
201
201
ID_FOR_ENTITY_NOT_REFERENCING_MAP , "alpha" , 24L , "beta" );
@@ -210,7 +210,7 @@ public void simpleEmbeddedGetsProperlyExtracted() throws SQLException {
210
210
}
211
211
212
212
@ Test // DATAJDBC-113
213
- public void collectionReferenceGetsLoadedWithAdditionalSelect () throws SQLException {
213
+ void collectionReferenceGetsLoadedWithAdditionalSelect () throws SQLException {
214
214
215
215
ResultSet rs = mockResultSet (asList ("ID" , "NAME" ), //
216
216
ID_FOR_ENTITY_NOT_REFERENCING_MAP , "alpha" );
@@ -225,7 +225,7 @@ public void collectionReferenceGetsLoadedWithAdditionalSelect() throws SQLExcept
225
225
}
226
226
227
227
@ Test // DATAJDBC-131
228
- public void mapReferenceGetsLoadedWithAdditionalSelect () throws SQLException {
228
+ void mapReferenceGetsLoadedWithAdditionalSelect () throws SQLException {
229
229
230
230
ResultSet rs = mockResultSet (asList ("ID" , "NAME" ), //
231
231
ID_FOR_ENTITY_REFERENCING_MAP , "alpha" );
@@ -240,7 +240,7 @@ public void mapReferenceGetsLoadedWithAdditionalSelect() throws SQLException {
240
240
}
241
241
242
242
@ Test // DATAJDBC-130
243
- public void listReferenceGetsLoadedWithAdditionalSelect () throws SQLException {
243
+ void listReferenceGetsLoadedWithAdditionalSelect () throws SQLException {
244
244
245
245
ResultSet rs = mockResultSet (asList ("ID" , "NAME" ), //
246
246
ID_FOR_ENTITY_REFERENCING_LIST , "alpha" );
@@ -255,7 +255,7 @@ public void listReferenceGetsLoadedWithAdditionalSelect() throws SQLException {
255
255
}
256
256
257
257
@ Test // DATAJDBC-252
258
- public void doesNotTryToSetPropertiesThatAreSetViaConstructor () throws SQLException {
258
+ void doesNotTryToSetPropertiesThatAreSetViaConstructor () throws SQLException {
259
259
260
260
ResultSet rs = mockResultSet (singletonList ("VALUE" ), //
261
261
"value-from-resultSet" );
@@ -268,7 +268,7 @@ public void doesNotTryToSetPropertiesThatAreSetViaConstructor() throws SQLExcept
268
268
}
269
269
270
270
@ Test // DATAJDBC-252
271
- public void handlesMixedProperties () throws SQLException {
271
+ void handlesMixedProperties () throws SQLException {
272
272
273
273
ResultSet rs = mockResultSet (asList ("ONE" , "TWO" , "THREE" ), //
274
274
"111" , "222" , "333" );
@@ -282,7 +282,7 @@ public void handlesMixedProperties() throws SQLException {
282
282
}
283
283
284
284
@ Test // DATAJDBC-359
285
- public void chainedEntitiesWithoutId () throws SQLException {
285
+ void chainedEntitiesWithoutId () throws SQLException {
286
286
287
287
// @formatter:off
288
288
Fixture <NoIdChain4 > fixture = this .<NoIdChain4 > buildFixture () //
@@ -318,7 +318,7 @@ public void chainedEntitiesWithoutId() throws SQLException {
318
318
}
319
319
320
320
@ Test // DATAJDBC-370
321
- public void simpleNullableImmutableEmbeddedGetsProperlyExtracted () throws SQLException {
321
+ void simpleNullableImmutableEmbeddedGetsProperlyExtracted () throws SQLException {
322
322
323
323
ResultSet rs = mockResultSet (asList ("ID" , "VALUE" , "NAME" ), //
324
324
ID_FOR_ENTITY_NOT_REFERENCING_MAP , "ru'Ha'" , "Alfred" );
@@ -334,7 +334,7 @@ public void simpleNullableImmutableEmbeddedGetsProperlyExtracted() throws SQLExc
334
334
}
335
335
336
336
@ Test // DATAJDBC-374
337
- public void simpleEmptyImmutableEmbeddedGetsProperlyExtracted () throws SQLException {
337
+ void simpleEmptyImmutableEmbeddedGetsProperlyExtracted () throws SQLException {
338
338
339
339
ResultSet rs = mockResultSet (asList ("ID" , "VALUE" , "NAME" ), //
340
340
ID_FOR_ENTITY_NOT_REFERENCING_MAP , null , null );
@@ -349,7 +349,7 @@ public void simpleEmptyImmutableEmbeddedGetsProperlyExtracted() throws SQLExcept
349
349
}
350
350
351
351
@ Test // DATAJDBC-370
352
- public void simplePrimitiveImmutableEmbeddedGetsProperlyExtracted () throws SQLException {
352
+ void simplePrimitiveImmutableEmbeddedGetsProperlyExtracted () throws SQLException {
353
353
354
354
ResultSet rs = mockResultSet (asList ("ID" , "VALUE" ), //
355
355
ID_FOR_ENTITY_NOT_REFERENCING_MAP , 24 );
@@ -365,7 +365,7 @@ public void simplePrimitiveImmutableEmbeddedGetsProperlyExtracted() throws SQLEx
365
365
}
366
366
367
367
@ Test // DATAJDBC-370
368
- public void simpleImmutableEmbeddedShouldBeNullIfAllOfTheEmbeddableAreNull () throws SQLException {
368
+ void simpleImmutableEmbeddedShouldBeNullIfAllOfTheEmbeddableAreNull () throws SQLException {
369
369
370
370
ResultSet rs = mockResultSet (asList ("ID" , "VALUE" , "NAME" ), //
371
371
ID_FOR_ENTITY_NOT_REFERENCING_MAP , null , null );
@@ -381,7 +381,7 @@ public void simpleImmutableEmbeddedShouldBeNullIfAllOfTheEmbeddableAreNull() thr
381
381
}
382
382
383
383
@ Test // DATAJDBC-370
384
- public void embeddedShouldBeNullWhenFieldsAreNull () throws SQLException {
384
+ void embeddedShouldBeNullWhenFieldsAreNull () throws SQLException {
385
385
386
386
ResultSet rs = mockResultSet (asList ("ID" , "NAME" , "PREFIX_ID" , "PREFIX_NAME" ), //
387
387
ID_FOR_ENTITY_NOT_REFERENCING_MAP , "alpha" , null , null );
@@ -396,7 +396,7 @@ public void embeddedShouldBeNullWhenFieldsAreNull() throws SQLException {
396
396
}
397
397
398
398
@ Test // DATAJDBC-370
399
- public void embeddedShouldNotBeNullWhenAtLeastOneFieldIsNotNull () throws SQLException {
399
+ void embeddedShouldNotBeNullWhenAtLeastOneFieldIsNotNull () throws SQLException {
400
400
401
401
ResultSet rs = mockResultSet (asList ("ID" , "NAME" , "PREFIX_ID" , "PREFIX_NAME" ), //
402
402
ID_FOR_ENTITY_NOT_REFERENCING_MAP , "alpha" , 24 , null );
@@ -411,7 +411,7 @@ public void embeddedShouldNotBeNullWhenAtLeastOneFieldIsNotNull() throws SQLExce
411
411
}
412
412
413
413
@ Test // DATAJDBC-370
414
- public void primitiveEmbeddedShouldBeNullWhenNoValuePresent () throws SQLException {
414
+ void primitiveEmbeddedShouldBeNullWhenNoValuePresent () throws SQLException {
415
415
416
416
ResultSet rs = mockResultSet (asList ("ID" , "VALUE" ), //
417
417
ID_FOR_ENTITY_NOT_REFERENCING_MAP , null );
@@ -427,7 +427,7 @@ public void primitiveEmbeddedShouldBeNullWhenNoValuePresent() throws SQLExceptio
427
427
}
428
428
429
429
@ Test // DATAJDBC-370
430
- public void deepNestedEmbeddable () throws SQLException {
430
+ void deepNestedEmbeddable () throws SQLException {
431
431
432
432
ResultSet rs = mockResultSet (asList ("ID" , "LEVEL0" , "LEVEL1_VALUE" , "LEVEL1_LEVEL2_VALUE" , "LEVEL1_LEVEL2_NAME" ), //
433
433
ID_FOR_ENTITY_NOT_REFERENCING_MAP , "0" , "1" , "2" , "Rumpelstilzchen" );
@@ -442,7 +442,7 @@ public void deepNestedEmbeddable() throws SQLException {
442
442
}
443
443
444
444
@ Test // DATAJDBC-341
445
- public void missingValueForObjectGetsMappedToZero () throws SQLException {
445
+ void missingValueForObjectGetsMappedToZero () throws SQLException {
446
446
447
447
ResultSet rs = mockResultSet (singletonList ("id" ), //
448
448
ID_FOR_ENTITY_NOT_REFERENCING_MAP );
@@ -457,7 +457,7 @@ public void missingValueForObjectGetsMappedToZero() throws SQLException {
457
457
}
458
458
459
459
@ Test // DATAJDBC-341
460
- public void missingValueForConstructorArgCausesException () throws SQLException {
460
+ void missingValueForConstructorArgCausesException () throws SQLException {
461
461
462
462
ResultSet rs = mockResultSet (singletonList ("id" ), //
463
463
ID_FOR_ENTITY_NOT_REFERENCING_MAP );
@@ -470,7 +470,7 @@ public void missingValueForConstructorArgCausesException() throws SQLException {
470
470
}
471
471
472
472
@ Test // DATAJDBC-341
473
- public void missingColumnForPrimitiveGetsMappedToZero () throws SQLException {
473
+ void missingColumnForPrimitiveGetsMappedToZero () throws SQLException {
474
474
475
475
ResultSet rs = mockResultSet (singletonList ("id" ), //
476
476
ID_FOR_ENTITY_NOT_REFERENCING_MAP );
@@ -486,7 +486,7 @@ public void missingColumnForPrimitiveGetsMappedToZero() throws SQLException {
486
486
}
487
487
488
488
@ Test // DATAJDBC-341
489
- public void columnNamesAreCaseInsensitive () throws SQLException {
489
+ void columnNamesAreCaseInsensitive () throws SQLException {
490
490
491
491
ResultSet rs = mockResultSet (asList ("id" , "name" ), //
492
492
ID_FOR_ENTITY_NOT_REFERENCING_MAP , "alpha" );
@@ -501,7 +501,7 @@ public void columnNamesAreCaseInsensitive() throws SQLException {
501
501
}
502
502
503
503
@ Test // DATAJDBC-341
504
- public void immutableEmbeddedWithAllColumnsMissingShouldBeNull () throws SQLException {
504
+ void immutableEmbeddedWithAllColumnsMissingShouldBeNull () throws SQLException {
505
505
506
506
ResultSet rs = mockResultSet (asList ("ID" ), //
507
507
ID_FOR_ENTITY_NOT_REFERENCING_MAP );
@@ -517,7 +517,7 @@ public void immutableEmbeddedWithAllColumnsMissingShouldBeNull() throws SQLExcep
517
517
}
518
518
519
519
@ Test // DATAJDBC-341
520
- public void immutableEmbeddedWithSomeColumnsMissingShouldNotBeEmpty () throws SQLException {
520
+ void immutableEmbeddedWithSomeColumnsMissingShouldNotBeEmpty () throws SQLException {
521
521
522
522
ResultSet rs = mockResultSet (asList ("ID" , "VALUE" ), //
523
523
ID_FOR_ENTITY_NOT_REFERENCING_MAP , "some value" );
@@ -529,7 +529,7 @@ public void immutableEmbeddedWithSomeColumnsMissingShouldNotBeEmpty() throws SQL
529
529
}
530
530
531
531
@ Test // DATAJDBC-341
532
- public void immutableEmbeddedWithSomeColumnsMissingAndSomeNullShouldBeNull () throws SQLException {
532
+ void immutableEmbeddedWithSomeColumnsMissingAndSomeNullShouldBeNull () throws SQLException {
533
533
534
534
ResultSet rs = mockResultSet (asList ("ID" , "VALUE" ), //
535
535
ID_FOR_ENTITY_NOT_REFERENCING_MAP , null );
@@ -545,7 +545,7 @@ public void immutableEmbeddedWithSomeColumnsMissingAndSomeNullShouldBeNull() thr
545
545
}
546
546
547
547
@ Test // DATAJDBC-341
548
- public void embeddedShouldBeNullWhenAllFieldsAreMissing () throws SQLException {
548
+ void embeddedShouldBeNullWhenAllFieldsAreMissing () throws SQLException {
549
549
550
550
ResultSet rs = mockResultSet (asList ("ID" , "NAME" ), //
551
551
ID_FOR_ENTITY_NOT_REFERENCING_MAP , "alpha" );
@@ -560,7 +560,7 @@ public void embeddedShouldBeNullWhenAllFieldsAreMissing() throws SQLException {
560
560
}
561
561
562
562
@ Test // DATAJDBC-341
563
- public void missingColumnsInEmbeddedShouldBeUnset () throws SQLException {
563
+ void missingColumnsInEmbeddedShouldBeUnset () throws SQLException {
564
564
565
565
ResultSet rs = mockResultSet (asList ("ID" , "NAME" , "PREFIX_ID" ), //
566
566
ID_FOR_ENTITY_NOT_REFERENCING_MAP , "alpha" , 24 );
@@ -575,7 +575,7 @@ public void missingColumnsInEmbeddedShouldBeUnset() throws SQLException {
575
575
}
576
576
577
577
@ Test // DATAJDBC-341
578
- public void primitiveEmbeddedShouldBeNullWhenAllColumnsAreMissing () throws SQLException {
578
+ void primitiveEmbeddedShouldBeNullWhenAllColumnsAreMissing () throws SQLException {
579
579
580
580
ResultSet rs = mockResultSet (asList ("ID" ), //
581
581
ID_FOR_ENTITY_NOT_REFERENCING_MAP );
@@ -591,7 +591,7 @@ public void primitiveEmbeddedShouldBeNullWhenAllColumnsAreMissing() throws SQLEx
591
591
}
592
592
593
593
@ Test // DATAJDBC-341
594
- public void oneToOneWithMissingColumnResultsInNullProperty () throws SQLException {
594
+ void oneToOneWithMissingColumnResultsInNullProperty () throws SQLException {
595
595
596
596
ResultSet rs = mockResultSet (asList ("ID" , "NAME" , "CHILD_ID" ), //
597
597
ID_FOR_ENTITY_NOT_REFERENCING_MAP , "alpha" , 24L );
@@ -606,7 +606,7 @@ public void oneToOneWithMissingColumnResultsInNullProperty() throws SQLException
606
606
}
607
607
608
608
@ Test // DATAJDBC-341
609
- public void oneToOneWithMissingIdColumnResultsInNullProperty () throws SQLException {
609
+ void oneToOneWithMissingIdColumnResultsInNullProperty () throws SQLException {
610
610
611
611
ResultSet rs = mockResultSet (asList ("ID" , "NAME" , "CHILD_NAME" ), //
612
612
ID_FOR_ENTITY_NOT_REFERENCING_MAP , "alpha" , "Alfred" );
@@ -618,7 +618,7 @@ public void oneToOneWithMissingIdColumnResultsInNullProperty() throws SQLExcepti
618
618
}
619
619
620
620
@ Test // DATAJDBC-341
621
- public void immutableOneToOneWithIdMissingColumnResultsInNullReference () throws SQLException {
621
+ void immutableOneToOneWithIdMissingColumnResultsInNullReference () throws SQLException {
622
622
623
623
ResultSet rs = mockResultSet (asList ("ID" , "NAME" , "CHILD_NAME" ), //
624
624
ID_FOR_ENTITY_NOT_REFERENCING_MAP , "alpha" , "Alfred" );
@@ -632,7 +632,7 @@ public void immutableOneToOneWithIdMissingColumnResultsInNullReference() throws
632
632
}
633
633
634
634
@ Test // DATAJDBC-508
635
- public void materializesObjectWithAtValue () throws SQLException {
635
+ void materializesObjectWithAtValue () throws SQLException {
636
636
637
637
ResultSet rs = mockResultSet (asList ("ID" , "FIRST_NAME" ), //
638
638
123L , "Hello World" );
@@ -939,7 +939,7 @@ private static class ResultSetAnswer implements Answer<Object> {
939
939
private final List <Map <String , Object >> values ;
940
940
private int index = -1 ;
941
941
942
- public ResultSetAnswer (List <String > names , List <Map <String , Object >> values ) {
942
+ ResultSetAnswer (List <String > names , List <Map <String , Object >> values ) {
943
943
944
944
this .names = names ;
945
945
this .values = values ;
0 commit comments