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
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)
The text was updated successfully, but these errors were encountered:
Hai,
I am getting the following exception when asserting 2 JSONArray objects if any of its value contains null. The code I used is
This causes exception
The text was updated successfully, but these errors were encountered: