diff --git a/JSONMLTest.java b/JSONMLTest.java index a16f0ea..953a39d 100644 --- a/JSONMLTest.java +++ b/JSONMLTest.java @@ -655,7 +655,9 @@ public class JSONMLTest { // lastly, confirm the restored JSONObject XML and JSONArray XML look // reasonably similar - Util.compareXML(jsonObjectXmlToStr, jsonArrayXmlToStr); + JSONObject jsonObjectFromObject = JSONML.toJSONObject(jsonObjectXmlToStr); + JSONObject jsonObjectFromArray = JSONML.toJSONObject(jsonArrayXmlToStr); + Util.compareActualVsExpectedJsonObjects(jsonObjectFromObject, jsonObjectFromArray); } /** diff --git a/Util.java b/Util.java index eb33ab5..8446690 100644 --- a/Util.java +++ b/Util.java @@ -94,49 +94,4 @@ public class Util { value.toString().equals(expectedValue.toString())); } } - - /** - * Sometimes test completion requires comparison of JSONArray objects that - * were produced from a JSONObject, and so unordered. This method is - * imperfect since it only compares the array elements and won't catch - * JSON syntax errors but at least it does not rely on ordering - *
- * It is expected that the arrays to be compared come from JSONArray - * instances which have been rendered by toString(), and whose syntax - * chars have been removed. - *
- * TODO: why are we not simply comparing the JSONArrays? - *
- * @param names an array of strings for comparison
- * @param expectedNames the other array of strings for comparison
- */
- public static void compareActualVsExpectedStringArrays(String[] names,
- String [] expectedNames) {
- assertTrue("Array lengths should be equal",
- names.length == expectedNames.length);
- List