This is an automated email from the ASF dual-hosted git repository. rmannibucau pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/johnzon.git
The following commit(s) were added to refs/heads/master by this push: new e532f7b [JOHNZON-320] Fix AdapterTest on Windows (#66) e532f7b is described below commit e532f7bf39e683e8da3bab88726e16f062fdf91e Author: Markus <54570207+marku...@users.noreply.github.com> AuthorDate: Sat Jul 25 19:07:14 2020 +0200 [JOHNZON-320] Fix AdapterTest on Windows (#66) --- .../test/java/org/apache/johnzon/jsonb/AdapterTest.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/AdapterTest.java b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/AdapterTest.java index 9a69bb7..862c10e 100644 --- a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/AdapterTest.java +++ b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/AdapterTest.java @@ -64,8 +64,14 @@ public class AdapterTest { try (final Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withAdapters(new PathAdapter()))) { final PathWrapper wrapper = new PathWrapper(); wrapper.path = Paths.get("/example/file.txt"); - assertEquals("{\"path\":\"/example/file.txt\"}", jsonb.toJson(wrapper)); - assertEquals("\"/example/file.txt\"", jsonb.toJson(wrapper.path)); + + if (System.getProperty("os.name").contains("Windows")) { + assertEquals("{\"path\":\"\\\\example\\\\file.txt\"}", jsonb.toJson(wrapper)); + assertEquals("\"\\\\example\\\\file.txt\"", jsonb.toJson(wrapper.path)); + } else { + assertEquals("{\"path\":\"/example/file.txt\"}", jsonb.toJson(wrapper)); + assertEquals("\"/example/file.txt\"", jsonb.toJson(wrapper.path)); + } } } @@ -109,7 +115,7 @@ public class AdapterTest { try (final Jsonb jsonb = JsonbBuilder.create()) { final Baz baz = new Baz(); baz.value = "test"; - + final String toString = jsonb.toJson(baz); assertEquals("\"test\"", toString); } @@ -205,7 +211,7 @@ public class AdapterTest { @JsonbTypeAdapter(DummyAdapter.class) public Dummy dummy; - + public Baz baz; }