You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2023/02/10 00:43:11 UTC
[brooklyn-server] 01/02: fix one test which is too strict around millisecond rounding in Instant
This is an automated email from the ASF dual-hosted git repository.
heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git
commit d5bf4b0176c5b69155ebfefc6ec69d1c979af335
Author: Alex Heneveld <al...@cloudsoft.io>
AuthorDate: Thu Feb 9 23:18:52 2023 +0000
fix one test which is too strict around millisecond rounding in Instant
---
.../apache/brooklyn/rest/util/json/BrooklynJacksonSerializerTest.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonSerializerTest.java b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonSerializerTest.java
index d3882c1943..a248fceebb 100644
--- a/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonSerializerTest.java
+++ b/rest/rest-resources/src/test/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonSerializerTest.java
@@ -379,7 +379,8 @@ public class BrooklynJacksonSerializerTest {
log.info("Instant json is: "+xs);
Assert.assertFalse(xs.contains("error"), "Shouldn't have had an error, instead got: "+xs);
Instant x2 = checkSerializesAs(x, Instant.class);
- Asserts.assertEquals(x2, x);
+ // instants sometimes round by one ms, as noted elsewhere in other tests
+ Asserts.assertThat(Math.abs(x2.toEpochMilli() - x.toEpochMilli()), diff -> diff < 2);
}
@Test