Java 11 causes Instant-based unit test to fail

Description

When building the maven project with Java 11, a test fails:

 

Environment

None

Activity

Show:
Greg Thomas
April 19, 2019, 4:46 PM

Every day is a school day.

It turns out that as of Java 9, Instant.now() has nanosecond resolution when it's available. As we're only saving the instant in the DB with millisecond resolution, there's now a (slight!) difference when it's retrieved again. 

The fix is easy enough; truncate the Instant before saving it. I'm not going to lose any sleep over losing the nano-second precision when saving properties.

Daryl Herzmann
April 19, 2019, 4:09 PM

I gave this a shot, but was unsure what to do.  The SystemProperty class appears to round trip the Instant value with nano-seconds dropped, so when it comes back for comparison, the values are no longer exactly equal.

Fixed

Assignee

Greg Thomas

Reporter

Guus der Kinderen