When running under Java 11, `Instant.now()` has mi...
# strikt
e
When running under Java 11,
Instant.now()
has microseconds, but under Java 8, only millis. So sometimes running tests inside a Java 11 container using
isEqualTo
will fail that passed under Java 8. I just added this to our extensions:
Copy code
// Java 11 Instant.now() has more resolution than Java 8, so need to only compare millis, not micros+
public fun DescribeableBuilder<Instant>.isApproximatelyEqualTo(value: Instant, delta: Duration = Duration.ofMillis(1)) {
    get { Duration.between(this, value).abs() }.isLessThan(delta)
}
Not sure if this is worth a PR or if it would go in core or jvm module.