@@ -2438,7 +2438,6 @@ void shouldUseMostConcreteCustomConversionTargetOnRead() {
2438
2438
verify (subTypeOfGenericTypeConverter ).convert (eq (source ));
2439
2439
}
2440
2440
2441
-
2442
2441
@ Test // GH-3660
2443
2442
void usesCustomConverterForMapTypesOnWrite () {
2444
2443
@@ -2482,9 +2481,8 @@ void usesCustomConverterForTypesImplementingMapOnRead() {
2482
2481
}));
2483
2482
converter .afterPropertiesSet ();
2484
2483
2485
- org .bson .Document source = new org .bson .Document ("1st" , "one" )
2486
- .append ("2nd" , 2 )
2487
- .append ("_class" , TypeImplementingMap .class .getName ());
2484
+ org .bson .Document source = new org .bson .Document ("1st" , "one" ).append ("2nd" , 2 ).append ("_class" ,
2485
+ TypeImplementingMap .class .getName ());
2488
2486
2489
2487
TypeImplementingMap target = converter .read (TypeImplementingMap .class , source );
2490
2488
@@ -2519,9 +2517,8 @@ void usesCustomConverterForPropertiesUsingTypesImplementingMapOnRead() {
2519
2517
converter .afterPropertiesSet ();
2520
2518
2521
2519
org .bson .Document source = new org .bson .Document ("typeImplementingMap" ,
2522
- new org .bson .Document ("1st" , "one" )
2523
- .append ("2nd" , 2 ))
2524
- .append ("_class" , TypeWrappingTypeImplementingMap .class .getName ());
2520
+ new org .bson .Document ("1st" , "one" ).append ("2nd" , 2 )).append ("_class" ,
2521
+ TypeWrappingTypeImplementingMap .class .getName ());
2525
2522
2526
2523
TypeWrappingTypeImplementingMap target = converter .read (TypeWrappingTypeImplementingMap .class , source );
2527
2524
@@ -2543,13 +2540,12 @@ void shouldWriteNullPropertyCorrectly() {
2543
2540
@ Test // GH-3686
2544
2541
void readsCollectionContainingNullValue () {
2545
2542
2546
- org .bson .Document source = new org .bson .Document ("items" , Arrays .asList (new org .bson .Document ("itemKey" , "i1" ), null , new org .bson .Document ("itemKey" , "i3" )));
2543
+ org .bson .Document source = new org .bson .Document ("items" ,
2544
+ Arrays .asList (new org .bson .Document ("itemKey" , "i1" ), null , new org .bson .Document ("itemKey" , "i3" )));
2547
2545
2548
2546
Order target = converter .read (Order .class , source );
2549
2547
2550
- assertThat (target .items )
2551
- .map (it -> it != null ? it .itemKey : null )
2552
- .containsExactly ("i1" , null , "i3" );
2548
+ assertThat (target .items ).map (it -> it != null ? it .itemKey : null ).containsExactly ("i1" , null , "i3" );
2553
2549
}
2554
2550
2555
2551
@ Test // GH-3686
@@ -2565,14 +2561,13 @@ void readsArrayContainingNullValue() {
2565
2561
@ Test // GH-3686
2566
2562
void readsMapContainingNullValue () {
2567
2563
2568
- org .bson .Document source = new org .bson .Document ("mapOfObjects" , new org .bson .Document ("item1" , "i1" ).append ("item2" , null ).append ("item3" , "i3" ));
2564
+ org .bson .Document source = new org .bson .Document ("mapOfObjects" ,
2565
+ new org .bson .Document ("item1" , "i1" ).append ("item2" , null ).append ("item3" , "i3" ));
2569
2566
2570
2567
ClassWithMapProperty target = converter .read (ClassWithMapProperty .class , source );
2571
2568
2572
- assertThat (target .mapOfObjects )
2573
- .containsEntry ("item1" , "i1" )
2574
- .containsEntry ("item2" , null )
2575
- .containsEntry ("item3" , "i3" );
2569
+ assertThat (target .mapOfObjects ).containsEntry ("item1" , "i1" ).containsEntry ("item2" , null ).containsEntry ("item3" ,
2570
+ "i3" );
2576
2571
}
2577
2572
2578
2573
@ Test // GH-3670
@@ -2584,7 +2579,7 @@ void appliesCustomConverterEvenToSimpleTypes() {
2584
2579
}));
2585
2580
converter .afterPropertiesSet ();
2586
2581
2587
- org .bson .Document source = new org .bson .Document ("content" , new Binary (new byte [] {0x00 , 0x42 }));
2582
+ org .bson .Document source = new org .bson .Document ("content" , new Binary (new byte [] { 0x00 , 0x42 }));
2588
2583
2589
2584
GenericType <Object > target = converter .read (GenericType .class , source );
2590
2585
assertThat (target .content ).isInstanceOf (byte [].class );
@@ -2593,17 +2588,20 @@ void appliesCustomConverterEvenToSimpleTypes() {
2593
2588
@ Test // GH-3702
2594
2589
void readsRawDocument () {
2595
2590
2596
- org .bson .Document source = new org .bson .Document ("_id" , "id-1" ).append ("raw" , new org .bson .Document ("simple" , 1 ).append ("document" , new org .bson .Document ("inner-doc" , 1 )));
2591
+ org .bson .Document source = new org .bson .Document ("_id" , "id-1" ).append ("raw" ,
2592
+ new org .bson .Document ("simple" , 1 ).append ("document" , new org .bson .Document ("inner-doc" , 1 )));
2597
2593
2598
2594
WithRawDocumentProperties target = converter .read (WithRawDocumentProperties .class , source );
2599
2595
2600
- assertThat (target .raw ).isInstanceOf (org .bson .Document .class ).isEqualTo ( new org .bson .Document ("simple" , 1 ).append ("document" , new org .bson .Document ("inner-doc" , 1 )));
2596
+ assertThat (target .raw ).isInstanceOf (org .bson .Document .class )
2597
+ .isEqualTo (new org .bson .Document ("simple" , 1 ).append ("document" , new org .bson .Document ("inner-doc" , 1 )));
2601
2598
}
2602
2599
2603
2600
@ Test // GH-3702
2604
2601
void readsListOfRawDocument () {
2605
2602
2606
- org .bson .Document source = new org .bson .Document ("_id" , "id-1" ).append ("listOfRaw" , Arrays .asList (new org .bson .Document ("simple" , 1 ).append ("document" , new org .bson .Document ("inner-doc" , 1 ))));
2603
+ org .bson .Document source = new org .bson .Document ("_id" , "id-1" ).append ("listOfRaw" ,
2604
+ Arrays .asList (new org .bson .Document ("simple" , 1 ).append ("document" , new org .bson .Document ("inner-doc" , 1 ))));
2607
2605
2608
2606
WithRawDocumentProperties target = converter .read (WithRawDocumentProperties .class , source );
2609
2607
@@ -2614,11 +2612,12 @@ void readsListOfRawDocument() {
2614
2612
@ Test // GH-3692
2615
2613
void readsMapThatDoesNotComeAsDocument () {
2616
2614
2617
- org .bson .Document source = new org .bson .Document ("_id" , "id-1" ).append ("mapOfObjects" , Collections .singletonMap ("simple" , 1 ));
2615
+ org .bson .Document source = new org .bson .Document ("_id" , "id-1" ).append ("mapOfObjects" ,
2616
+ Collections .singletonMap ("simple" , 1 ));
2618
2617
2619
2618
ClassWithMapProperty target = converter .read (ClassWithMapProperty .class , source );
2620
2619
2621
- assertThat (target .mapOfObjects ).containsEntry ("simple" ,1 );
2620
+ assertThat (target .mapOfObjects ).containsEntry ("simple" , 1 );
2622
2621
}
2623
2622
2624
2623
@ Test // GH-3851
@@ -2638,7 +2637,8 @@ void readsMapThatDoesNotComeAsDocument() {
2638
2637
2639
2638
converter .writePropertyInternal (sourceValue , accessor , persistentProperty );
2640
2639
2641
- assertThat (accessor .getDocument ()).isEqualTo (new org .bson .Document ("pName" , new org .bson .Document ("_id" , id .toString ())));
2640
+ assertThat (accessor .getDocument ())
2641
+ .isEqualTo (new org .bson .Document ("pName" , new org .bson .Document ("_id" , id .toString ())));
2642
2642
}
2643
2643
2644
2644
@ Test // GH-2860
@@ -2652,8 +2652,7 @@ void projectShouldReadSimpleInterfaceProjection() {
2652
2652
.and ((target , underlyingType ) -> !converter .conversions .isSimpleType (target )),
2653
2653
mappingContext );
2654
2654
2655
- EntityProjection <PersonProjection , Person > projection = discoverer
2656
- .introspect (PersonProjection .class , Person .class );
2655
+ EntityProjection <PersonProjection , Person > projection = discoverer .introspect (PersonProjection .class , Person .class );
2657
2656
PersonProjection person = converter .project (projection , source );
2658
2657
2659
2658
assertThat (person .getBirthDate ()).isEqualTo (new LocalDate (1999 , 12 , 1 ));
@@ -2671,8 +2670,7 @@ void projectShouldReadSimpleDtoProjection() {
2671
2670
.and ((target , underlyingType ) -> !converter .conversions .isSimpleType (target )),
2672
2671
mappingContext );
2673
2672
2674
- EntityProjection <PersonDto , Person > projection = introspector
2675
- .introspect (PersonDto .class , Person .class );
2673
+ EntityProjection <PersonDto , Person > projection = introspector .introspect (PersonDto .class , Person .class );
2676
2674
PersonDto person = converter .project (projection , source );
2677
2675
2678
2676
assertThat (person .getBirthDate ()).isEqualTo (new LocalDate (1999 , 12 , 1 ));
@@ -2763,8 +2761,7 @@ interface InterfaceType {
2763
2761
@ EqualsAndHashCode
2764
2762
@ Getter
2765
2763
static class Address implements InterfaceType {
2766
- @ Field ("s" )
2767
- String street ;
2764
+ @ Field ("s" ) String street ;
2768
2765
String city ;
2769
2766
}
2770
2767
@@ -3365,7 +3362,7 @@ static class TypeWrappingTypeImplementingMap {
3365
3362
}
3366
3363
3367
3364
@ EqualsAndHashCode
3368
- static class TypeImplementingMap implements Map <String ,String > {
3365
+ static class TypeImplementingMap implements Map <String , String > {
3369
3366
3370
3367
String val1 ;
3371
3368
int val2 ;
@@ -3480,15 +3477,9 @@ static class Book {
3480
3477
3481
3478
Author author = new Author ();
3482
3479
3483
- public Book () {}
3484
-
3485
- public Book (String id , String name , Author author ) {
3486
- this .id = id ;
3487
- this .name = name ;
3488
- this .author = author ;
3489
- }
3490
3480
}
3491
3481
3482
+ @ Data
3492
3483
static class Author {
3493
3484
3494
3485
@ Id String id ;
@@ -3497,14 +3488,6 @@ static class Author {
3497
3488
3498
3489
String lastName ;
3499
3490
3500
- public Author () {}
3501
-
3502
- public Author (String id , String firstName , String lastName ) {
3503
- this .id = id ;
3504
- this .firstName = firstName ;
3505
- this .lastName = lastName ;
3506
- }
3507
-
3508
3491
}
3509
3492
3510
3493
}
0 commit comments