From 79dc8f5adcde53ed95a699e9b57735bc7f31134f Mon Sep 17 00:00:00 2001 From: Bala Sukesh Date: Fri, 6 Oct 2023 07:24:08 -0500 Subject: [PATCH] Use JSONAssert instead of Assert in JSONUtilTest (#1495) Co-authored-by: bbelide2 --- .../test/java/cn/hippo4j/common/toolkit/JSONUtilTest.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/infra/common/src/test/java/cn/hippo4j/common/toolkit/JSONUtilTest.java b/infra/common/src/test/java/cn/hippo4j/common/toolkit/JSONUtilTest.java index e01ff4cd..05faebf1 100644 --- a/infra/common/src/test/java/cn/hippo4j/common/toolkit/JSONUtilTest.java +++ b/infra/common/src/test/java/cn/hippo4j/common/toolkit/JSONUtilTest.java @@ -24,6 +24,8 @@ import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import org.junit.Assert; import org.junit.Test; +import org.json.JSONException; +import org.skyscreamer.jsonassert.JSONAssert; import java.util.Arrays; import java.util.Collections; @@ -42,7 +44,11 @@ public class JSONUtilTest { @Test public void assertToJSONString() { Assert.assertNull(JSONUtil.toJSONString(null)); - Assert.assertEquals(EXPECTED_FOO_JSON, JSONUtil.toJSONString(EXPECTED_FOO)); + try { + JSONAssert.assertEquals(EXPECTED_FOO_JSON, JSONUtil.toJSONString(EXPECTED_FOO), false); + } catch (JSONException jse) { + throw new RuntimeException(jse); + } } @Test