From a3742acf74947b9ccd45bc6190111f619cb95cb6 Mon Sep 17 00:00:00 2001 From: "John J. Aylward" Date: Mon, 6 Nov 2023 17:48:18 -0500 Subject: [PATCH] Fixes #821 add ignore annotation to tests that may fail due to differences in machine resources and can't be controlled via the tests --- src/test/java/org/json/junit/JSONArrayTest.java | 4 +++- src/test/java/org/json/junit/JSONObjectTest.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/json/junit/JSONArrayTest.java b/src/test/java/org/json/junit/JSONArrayTest.java index e877070..7b0d52e 100644 --- a/src/test/java/org/json/junit/JSONArrayTest.java +++ b/src/test/java/org/json/junit/JSONArrayTest.java @@ -32,6 +32,7 @@ import org.json.JSONPointerException; import org.json.JSONString; import org.json.JSONTokener; import org.json.junit.data.MyJsonString; +import org.junit.Ignore; import org.junit.Test; import com.jayway.jsonpath.Configuration; @@ -1384,6 +1385,7 @@ public class JSONArrayTest { /** * Tests for stack overflow. See https://github.com/stleary/JSON-java/issues/654 */ + @Ignore("This test relies on system constraints and may not always pass. See: https://github.com/stleary/JSON-java/issues/821") @Test(expected = JSONException.class) public void issue654StackOverflowInputWellFormed() { //String input = new String(java.util.Base64.getDecoder().decode(base64Bytes)); @@ -1391,7 +1393,7 @@ public class JSONArrayTest { JSONTokener tokener = new JSONTokener(resourceAsStream); JSONArray json_input = new JSONArray(tokener); assertNotNull(json_input); - fail("Excepected Exception."); + fail("Excepected Exception due to stack overflow."); Util.checkJSONArrayMaps(json_input); } diff --git a/src/test/java/org/json/junit/JSONObjectTest.java b/src/test/java/org/json/junit/JSONObjectTest.java index 42b41b3..d9adbca 100644 --- a/src/test/java/org/json/junit/JSONObjectTest.java +++ b/src/test/java/org/json/junit/JSONObjectTest.java @@ -55,6 +55,7 @@ import org.json.junit.data.RecursiveBeanEquals; import org.json.junit.data.Singleton; import org.json.junit.data.SingletonEnum; import org.json.junit.data.WeirdList; +import org.junit.Ignore; import org.junit.Test; import com.jayway.jsonpath.Configuration; @@ -3665,6 +3666,7 @@ public class JSONObjectTest { /** * Tests for stack overflow. See https://github.com/stleary/JSON-java/issues/654 */ + @Ignore("This test relies on system constraints and may not always pass. See: https://github.com/stleary/JSON-java/issues/821") @Test(expected = JSONException.class) public void issue654StackOverflowInputWellFormed() { //String input = new String(java.util.Base64.getDecoder().decode(base64Bytes)); @@ -3672,7 +3674,7 @@ public class JSONObjectTest { JSONTokener tokener = new JSONTokener(resourceAsStream); JSONObject json_input = new JSONObject(tokener); assertNotNull(json_input); - fail("Excepected Exception."); + fail("Excepected Exception due to stack overflow."); } @Test