2121import java .time .Month ;
2222import java .time .ZoneId ;
2323import java .time .ZonedDateTime ;
24+ import java .time .temporal .ChronoUnit ;
2425import java .util .Calendar ;
2526import java .util .Currency ;
2627import java .util .Date ;
@@ -349,11 +350,11 @@ public void testWithLocalDateTimes(int initialSize) {
349350 Assert .assertEquals (actual .length (), expected .length , "The lengths match" );
350351 Assert .assertEquals (actual .typeCode (), ArrayType .LOCAL_DATETIME , "The array type is as expected" );
351352 for (int i =0 ; i <expected .length ; ++i ) {
352- Assert .assertEquals (actual .getValue (i ), expected [i ], "The values match at " + i );
353+ Assert .assertEquals (actual .getValue (i ), expected [i ]. truncatedTo ( ChronoUnit . MILLIS ) , "The values match at " + i );
353354 }
354355 final Array <LocalDateTime > collected = Stream .of (expected ).collect (ArrayUtils .toArray (expected .length ));
355356 for (int i =0 ; i <expected .length ; ++i ) {
356- Assert .assertEquals (collected .getValue (i ), expected [i ], "The values match at " + i );
357+ Assert .assertEquals (collected .getValue (i ), expected [i ]. truncatedTo ( ChronoUnit . MILLIS ) , "The values match at " + i );
357358 }
358359 }
359360
@@ -370,11 +371,11 @@ public void testWithZonedDateTimes(int initialSize) {
370371 Assert .assertEquals (actual .length (), expected .length , "The lengths match" );
371372 Assert .assertEquals (actual .typeCode (), ArrayType .ZONED_DATETIME , "The array type is as expected" );
372373 for (int i =0 ; i <expected .length ; ++i ) {
373- Assert .assertEquals (actual .getValue (i ), expected [i ], "The values match at " + i );
374+ Assert .assertEquals (actual .getValue (i ), expected [i ]. truncatedTo ( ChronoUnit . MILLIS ) , "The values match at " + i );
374375 }
375376 final Array <ZonedDateTime > collected = Stream .of (expected ).collect (ArrayUtils .toArray (expected .length ));
376377 for (int i =0 ; i <expected .length ; ++i ) {
377- Assert .assertEquals (collected .getValue (i ), expected [i ], "The values match at " + i );
378+ Assert .assertEquals (collected .getValue (i ), expected [i ]. truncatedTo ( ChronoUnit . MILLIS ) , "The values match at " + i );
378379 }
379380 }
380381
@@ -408,11 +409,19 @@ public void testWithMixedTypes(int initialSize) {
408409 Assert .assertEquals (actual .length (), expected .length , "The lengths match" );
409410 Assert .assertEquals (actual .typeCode (), ArrayType .OBJECT , "The array type is as expected" );
410411 for (int i =0 ; i <expected .length ; ++i ) {
411- Assert .assertEquals (actual .getValue (i ), expected [i ], "The values match at " + i );
412+ Object frmtValue = expected [i ];
413+ if (expected [i ].getClass ().getName () == "java.time.ZonedDateTime" ){
414+ frmtValue = ((ZonedDateTime ) frmtValue ).truncatedTo (ChronoUnit .MILLIS );
415+ }
416+ Assert .assertEquals (actual .getValue (i ),frmtValue , "The values match at " + i );
412417 }
413418 final Array <Object > collected = Stream .of (expected ).collect (ArrayUtils .toArray (expected .length ));
414419 for (int i =0 ; i <expected .length ; ++i ) {
415- Assert .assertEquals (collected .getValue (i ), expected [i ], "The values match at " + i );
420+ Object frmtValue = expected [i ];
421+ if (expected [i ].getClass ().getName () == "java.time.ZonedDateTime" ){
422+ frmtValue = ((ZonedDateTime ) frmtValue ).truncatedTo (ChronoUnit .MILLIS );
423+ }
424+ Assert .assertEquals (collected .getValue (i ), frmtValue , "The values match at " + i );
416425 }
417426 }
418427
0 commit comments