Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Integration test fails on JDK > 8 because of Instant resolution change #571

Copy link
Copy link
@fkomauli

Description

@fkomauli
Issue body actions

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) -> {

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.