From ce8c970ebd031082e2edc91260eec970a8171eaa Mon Sep 17 00:00:00 2001 From: Francesco Komauli Date: Wed, 7 Jun 2023 16:14:24 +0200 Subject: [PATCH] Java 11 forward-compatible test with java.time.Instant stored as timestamptz MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instant.now() precision changed from ms to ns since Java 11, so tests must deal with conversions to postgres μs --- .../postgresql/AbstractTemporalCodecIntegrationTests.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/java/io/r2dbc/postgresql/AbstractTemporalCodecIntegrationTests.java b/src/test/java/io/r2dbc/postgresql/AbstractTemporalCodecIntegrationTests.java index 1554b755..d395cade 100644 --- a/src/test/java/io/r2dbc/postgresql/AbstractTemporalCodecIntegrationTests.java +++ b/src/test/java/io/r2dbc/postgresql/AbstractTemporalCodecIntegrationTests.java @@ -27,6 +27,7 @@ import java.time.OffsetDateTime; import java.time.OffsetTime; import java.time.ZoneOffset; +import java.time.temporal.ChronoUnit; import java.util.TimeZone; import static org.assertj.core.api.Assertions.assertThat; @@ -201,7 +202,7 @@ void shouldConsiderInstantMinMax() { insert(Instant.parse("0000-12-31T01:01:00Z")); expectValue(Instant.parse("0000-12-31T01:01:00Z")); - Instant now = Instant.now(); + Instant now = Instant.now().truncatedTo(ChronoUnit.MICROS); insert(now); expectValue(now); }