Integration tests failure
Test AbstractCodecIntegrationTests::localDateTime fails because it serializes an Instant.now() value and compares it with the deserialized one without truncating it to microseconds.
The test completes successfully on JDK 8 as the Instant resolution is in milliseconds, but fails on JDK 17.
Truncation to microseconds was already used in the same test for LocalDateTimes, and was forgotten out for the Instant case.
Fix
diff --git a/src/test/java/io/r2dbc/postgresql/AbstractCodecIntegrationTests.java b/src/test/java/io/r2dbc/postgresql/AbstractCodecIntegrationTests.java
index 1cd585a..daf3d64 100644
--- a/src/test/java/io/r2dbc/postgresql/AbstractCodecIntegrationTests.java
+++ b/src/test/java/io/r2dbc/postgresql/AbstractCodecIntegrationTests.java
@@ -435,7 +435,7 @@ abstract class AbstractCodecIntegrationTests extends AbstractIntegrationTests {
testCodec(LocalDateTime.class, LocalDateTime.now().truncatedTo(ChronoUnit.MICROS), "TIMESTAMP");
testCodec(LocalDateTime.class, LocalDateTime.now().truncatedTo(ChronoUnit.MICROS), "TIMESTAMPTZ");
- Instant now = Instant.now();
+ Instant now = Instant.now().truncatedTo(ChronoUnit.MICROS);
LocalDateTime ldt = now.atZone(ZoneId.systemDefault()).toLocalDateTime();
testCodec(LocalDateTime.class, ldt, Instant.class, (actual, expected) -> {
Integration tests failure
Test
AbstractCodecIntegrationTests::localDateTimefails because it serializes anInstant.now()value and compares it with the deserialized one without truncating it to microseconds.The test completes successfully on JDK 8 as the Instant resolution is in milliseconds, but fails on JDK 17.
Truncation to microseconds was already used in the same test for
LocalDateTimes, and was forgotten out for theInstantcase.Fix