62
62
import java .time .ZoneId ;
63
63
import java .time .ZoneOffset ;
64
64
import java .time .ZonedDateTime ;
65
+ import java .time .temporal .ChronoUnit ;
65
66
import java .util .Date ;
66
67
import java .util .LinkedHashMap ;
67
68
import java .util .Map ;
@@ -270,7 +271,7 @@ void inetAddress() throws UnknownHostException {
270
271
271
272
@ Test
272
273
void instant () {
273
- testCodec (Instant .class , Instant .now (), "TIMESTAMPTZ" );
274
+ testCodec (Instant .class , Instant .now (). truncatedTo ( ChronoUnit . MICROS ) , "TIMESTAMPTZ" );
274
275
}
275
276
276
277
@ Test
@@ -362,12 +363,12 @@ void localDate() {
362
363
363
364
@ Test
364
365
void localDateTime () {
365
- testCodec (LocalDateTime .class , LocalDateTime .now (), "TIMESTAMP" );
366
+ testCodec (LocalDateTime .class , LocalDateTime .now (). truncatedTo ( ChronoUnit . MICROS ) , "TIMESTAMP" );
366
367
}
367
368
368
369
@ Test
369
370
void localTime () {
370
- testCodec (LocalTime .class , LocalTime .now (), "TIME" );
371
+ testCodec (LocalTime .class , LocalTime .now (). truncatedTo ( ChronoUnit . MICROS ) , "TIME" );
371
372
}
372
373
373
374
@ Test
@@ -393,7 +394,7 @@ void longTwoDimensionalArray() {
393
394
394
395
@ Test
395
396
void offsetDateTime () {
396
- testCodec (OffsetDateTime .class , OffsetDateTime .now (), (actual , expected ) -> assertThat (actual .isEqual (expected )).isTrue (), "TIMESTAMP WITH TIME ZONE" );
397
+ testCodec (OffsetDateTime .class , OffsetDateTime .now (). truncatedTo ( ChronoUnit . MICROS ) , (actual , expected ) -> assertThat (actual .isEqual (expected )).isTrue (), "TIMESTAMP WITH TIME ZONE" );
397
398
}
398
399
399
400
@ Test
@@ -474,16 +475,16 @@ void zoneId() {
474
475
475
476
@ Test
476
477
void zonedDateTime () {
477
- testCodec (ZonedDateTime .class , ZonedDateTime .now (), (actual , expected ) -> {
478
+ testCodec (ZonedDateTime .class , ZonedDateTime .now (). truncatedTo ( ChronoUnit . MICROS ) , (actual , expected ) -> {
478
479
assertThat (actual .toLocalDateTime ()).isEqualTo (expected .toLocalDateTime ());
479
480
}, "TIMESTAMP WITH TIME ZONE" );
480
481
}
481
482
482
483
@ Test
483
484
void offsetTime () {
484
- testCodec (OffsetTime .class , OffsetTime .of (LocalTime .now (), ZoneOffset .UTC ), "TIMETZ" );
485
- testCodec (OffsetTime .class , OffsetTime .of (LocalTime .now (), ZoneOffset .ofHoursMinutes (1 , 30 )), "TIMETZ" );
486
- testCodec (OffsetTime .class , OffsetTime .of (LocalTime .now (), ZoneOffset .ofHoursMinutes (-3 , -30 )), "TIMETZ" );
485
+ testCodec (OffsetTime .class , OffsetTime .of (LocalTime .now (). truncatedTo ( ChronoUnit . MICROS ) , ZoneOffset .UTC ), "TIMETZ" );
486
+ testCodec (OffsetTime .class , OffsetTime .of (LocalTime .now (). truncatedTo ( ChronoUnit . MICROS ) , ZoneOffset .ofHoursMinutes (1 , 30 )), "TIMETZ" );
487
+ testCodec (OffsetTime .class , OffsetTime .of (LocalTime .now (). truncatedTo ( ChronoUnit . MICROS ) , ZoneOffset .ofHoursMinutes (-3 , -30 )), "TIMETZ" );
487
488
}
488
489
489
490
@ Test
0 commit comments