You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Issue when comparing JSONArray if any value is null #105
Hai,
I am getting the following exception when asserting 2 JSONArray objects if any of its value contains null. The code I used is
public class TestJSONassert
{
public static void main(String args[])
{
JSONArray jsonArray1 = new JSONArray();
jsonArray1.put(1);
jsonArray1.put((Object)null);
jsonArray1.put(3);
jsonArray1.put(2);
JSONArray jsonArray2 = new JSONArray();
jsonArray2.put(1);
jsonArray2.put((Object)null);
jsonArray2.put(3);
jsonArray2.put(2);
JSONAssert.assertEquals(jsonArray1, jsonArray2, false);
}
}
This causes exception
Exception in thread "main" org.json.JSONException: JSONArray[1] not found.
at org.json.JSONArray.get(JSONArray.java:194)
at org.skyscreamer.jsonassert.comparator.JSONCompareUtil.allSimpleValues(JSONCompareUtil.java:139)
at org.skyscreamer.jsonassert.comparator.DefaultComparator.compareJSONArray(DefaultComparator.java:82)
at org.skyscreamer.jsonassert.comparator.AbstractComparator.compareJSON(AbstractComparator.java:56)
at org.skyscreamer.jsonassert.JSONCompare.compareJSON(JSONCompare.java:93)
at org.skyscreamer.jsonassert.JSONCompare.compareJSON(JSONCompare.java:154)
at org.skyscreamer.jsonassert.JSONAssert.assertEquals(JSONAssert.java:724)
at org.skyscreamer.jsonassert.JSONAssert.assertEquals(JSONAssert.java:651)
at test.util.TestJSONassert.main(TestJSONassert.java:22)
Activity
Fixes for issue skyscreamer#105
Merge pull request #111 from suraj1291993/master