2727import java .math .BigDecimal ;
2828import java .math .BigInteger ;
2929import java .net .URL ;
30+ import java .time .LocalDate ;
3031import java .time .LocalDateTime ;
32+ import java .time .ZoneOffset ;
3133import java .time .temporal .ChronoUnit ;
3234import java .util .*;
3335
34- import org .assertj .core .api .DateAssert ;
3536import org .bson .types .Binary ;
3637import org .bson .types .Code ;
3738import org .bson .types .Decimal128 ;
@@ -2615,7 +2616,8 @@ void readsMapThatDoesNotComeAsDocument() {
26152616 @ Test // GH-2860
26162617 void projectShouldReadSimpleInterfaceProjection () {
26172618
2618- org .bson .Document source = new org .bson .Document ("birthDate" , new LocalDate (1999 , 12 , 1 ).toDate ()).append ("foo" ,
2619+ org .bson .Document source = new org .bson .Document ("birthDate" ,
2620+ Date .from (LocalDate .of (1999 , 12 , 1 ).atStartOfDay ().toInstant (ZoneOffset .UTC ))).append ("foo" ,
26192621 "Walter" );
26202622
26212623 EntityProjectionIntrospector discoverer = EntityProjectionIntrospector .create (converter .getProjectionFactory (),
@@ -2627,14 +2629,15 @@ void projectShouldReadSimpleInterfaceProjection() {
26272629 .introspect (PersonProjection .class , Person .class );
26282630 PersonProjection person = converter .project (projection , source );
26292631
2630- assertThat (person .getBirthDate ()).isEqualTo (new LocalDate (1999 , 12 , 1 ));
2632+ assertThat (person .getBirthDate ()).isEqualTo (LocalDate . of (1999 , 12 , 1 ));
26312633 assertThat (person .getFirstname ()).isEqualTo ("Walter" );
26322634 }
26332635
26342636 @ Test // GH-2860
26352637 void projectShouldReadSimpleDtoProjection () {
26362638
2637- org .bson .Document source = new org .bson .Document ("birthDate" , new LocalDate (1999 , 12 , 1 ).toDate ()).append ("foo" ,
2639+ org .bson .Document source = new org .bson .Document ("birthDate" ,
2640+ Date .from (LocalDate .of (1999 , 12 , 1 ).atStartOfDay ().toInstant (ZoneOffset .UTC ))).append ("foo" ,
26382641 "Walter" );
26392642
26402643 EntityProjectionIntrospector introspector = EntityProjectionIntrospector .create (converter .getProjectionFactory (),
@@ -2646,7 +2649,7 @@ void projectShouldReadSimpleDtoProjection() {
26462649 .introspect (PersonDto .class , Person .class );
26472650 PersonDto person = converter .project (projection , source );
26482651
2649- assertThat (person .getBirthDate ()).isEqualTo (new LocalDate (1999 , 12 , 1 ));
2652+ assertThat (person .getBirthDate ()).isEqualTo (LocalDate . of (1999 , 12 , 1 ));
26502653 assertThat (person .getFirstname ()).isEqualTo ("Walter" );
26512654 }
26522655
0 commit comments