diff --git a/pom.xml b/pom.xml index 5b9eb758a..4a0791893 100644 --- a/pom.xml +++ b/pom.xml @@ -188,6 +188,22 @@ provided + + + org.glassfish.jaxb + jaxb-runtime + 2.4.0-b180830.0438 + provided + + + + javax.annotation + javax.annotation-api + 1.3.2 + provided + + + org.postgresql @@ -222,7 +238,7 @@ org.avaje avaje-agentloader - 2.1.2 + 3.0.0-SNAPSHOT test @@ -327,9 +343,10 @@ org.apache.maven.plugins maven-surefire-plugin - 2.5 + 2.22.1 false + false false **/Test*.java diff --git a/src/test/java/io/ebeaninternal/server/type/ScalarTypeInstantTest.java b/src/test/java/io/ebeaninternal/server/type/ScalarTypeInstantTest.java index f2593c08e..fccc8e355 100644 --- a/src/test/java/io/ebeaninternal/server/type/ScalarTypeInstantTest.java +++ b/src/test/java/io/ebeaninternal/server/type/ScalarTypeInstantTest.java @@ -16,13 +16,21 @@ public class ScalarTypeInstantTest { ScalarTypeInstant type = new ScalarTypeInstant(JsonConfig.DateTime.MILLIS); + private Instant now() { + // in JDK11 Instant.now() returns a nanosecond precise instant. + // as ScalarTypeInstant is only milliSecond precise, tests may fail with + // expected:<2019-02-10T15:39:36.702700200Z> but was:<2019-02-10T15:39:36.702Z> + // if we use Instant.now() - so we use this workaround here. + return Instant.ofEpochMilli(System.currentTimeMillis()); + } + @Test public void testReadData() throws Exception { ByteArrayOutputStream os = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(os); - Instant now = Instant.now(); + Instant now = now(); type.writeData(out, now); type.writeData(out, null); out.flush(); @@ -41,7 +49,7 @@ public class ScalarTypeInstantTest { @Test public void testToJdbcType() throws Exception { - Instant now = Instant.now(); + Instant now = now(); Timestamp timestamp = Timestamp.from(now); Object val1 = type.toJdbcType(now); Object val2 = type.toJdbcType(timestamp); @@ -53,7 +61,7 @@ public class ScalarTypeInstantTest { @Test public void testToBeanType() throws Exception { - Instant now = Instant.now(); + Instant now = now(); Instant val1 = type.toBeanType(now); Instant val2 = type.toBeanType(Timestamp.from(now)); @@ -64,7 +72,7 @@ public class ScalarTypeInstantTest { @Test public void testFormatValue() throws Exception { - Instant now = Instant.now(); + Instant now = now(); Timestamp timestamp = Timestamp.from(now); String formatted = type.formatValue(now); assertEquals("" + timestamp.getTime(), formatted); @@ -73,7 +81,7 @@ public class ScalarTypeInstantTest { @Test public void testParse_when_epochMillis() throws Exception { - Instant now = Instant.now(); + Instant now = now(); Timestamp timestamp = Timestamp.from(now); Instant val1 = type.parse("" + timestamp.getTime()); assertEquals(now, val1); @@ -82,7 +90,7 @@ public class ScalarTypeInstantTest { @Test public void testParse_when_timestampForm() throws Exception { - Instant now = Instant.now(); + Instant now = now(); Timestamp timestamp = Timestamp.from(now); Instant val1 = type.parse(timestamp.toString()); assertEquals(now, val1); @@ -91,7 +99,7 @@ public class ScalarTypeInstantTest { @Test public void testFormatAndParse() throws Exception { - Instant now = Instant.now(); + Instant now = now(); String format = type.format(now); Instant val1 = type.parse(format); @@ -107,7 +115,7 @@ public class ScalarTypeInstantTest { @Test public void testConvertFromMillis() throws Exception { - Instant now = Instant.now(); + Instant now = now(); Instant val = type.convertFromMillis(now.toEpochMilli()); assertEquals(now, val); } @@ -116,7 +124,7 @@ public class ScalarTypeInstantTest { public void testJsonRead() throws Exception { - Instant now = Instant.now(); + Instant now = now(); JsonTester jsonTester = new JsonTester<>(type); jsonTester.test(now); diff --git a/src/test/java/io/ebeaninternal/server/type/ScalarTypeLocalDateTimeTest.java b/src/test/java/io/ebeaninternal/server/type/ScalarTypeLocalDateTimeTest.java index b4dd13014..65850e947 100644 --- a/src/test/java/io/ebeaninternal/server/type/ScalarTypeLocalDateTimeTest.java +++ b/src/test/java/io/ebeaninternal/server/type/ScalarTypeLocalDateTimeTest.java @@ -28,7 +28,7 @@ public class ScalarTypeLocalDateTimeTest { @Test public void testConvertToMillis() throws Exception { - LocalDateTime now = LocalDateTime.now(); + LocalDateTime now = LocalDateTime.now().withNano(123_000_000); // jdk11 workaround long asMillis = type.convertToMillis(now); LocalDateTime fromMillis = type.convertFromMillis(asMillis); @@ -74,7 +74,7 @@ public class ScalarTypeLocalDateTimeTest { @Test public void testJson() throws Exception { - LocalDateTime now = LocalDateTime.now(); + LocalDateTime now = LocalDateTime.now().withNano(123_000_000); // jdk11 workaround JsonTester jsonTester = new JsonTester<>(type); jsonTester.test(now); diff --git a/src/test/java/io/ebeaninternal/server/type/ScalarTypeOffsetDateTimeTest.java b/src/test/java/io/ebeaninternal/server/type/ScalarTypeOffsetDateTimeTest.java index eb2bba0a7..c950d5814 100644 --- a/src/test/java/io/ebeaninternal/server/type/ScalarTypeOffsetDateTimeTest.java +++ b/src/test/java/io/ebeaninternal/server/type/ScalarTypeOffsetDateTimeTest.java @@ -61,7 +61,7 @@ public class ScalarTypeOffsetDateTimeTest { @Test public void testJson() throws Exception { - OffsetDateTime now = OffsetDateTime.now(); + OffsetDateTime now = OffsetDateTime.now().withNano(123_000_000); // jdk11 workaround JsonTester jsonTester = new JsonTester<>(type); jsonTester.test(now); diff --git a/src/test/java/io/ebeaninternal/server/type/ScalarTypeZonedDateTimeTest.java b/src/test/java/io/ebeaninternal/server/type/ScalarTypeZonedDateTimeTest.java index b9d40b708..be4570ac6 100644 --- a/src/test/java/io/ebeaninternal/server/type/ScalarTypeZonedDateTimeTest.java +++ b/src/test/java/io/ebeaninternal/server/type/ScalarTypeZonedDateTimeTest.java @@ -62,7 +62,7 @@ public class ScalarTypeZonedDateTimeTest { @Test public void testJson() throws Exception { - ZonedDateTime now = ZonedDateTime.now(); + ZonedDateTime now = ZonedDateTime.now().withNano(123_000_000); // jdk11 workaround JsonTester jsonTester = new JsonTester<>(type); jsonTester.test(now);