The following line,
JSONAssert.assertEquals("[{id:1},]" , "[{id:1},{}]" , true);,
which inputs an invalid JSON string "[{id:1},]" to assertEquals,
will throw java.lang.NullPointerException.
(I think the string is invalid because the JsonArray contains no more element after a comma.)
By the way, the following line,
JSONAssert.assertEquals("[{id:1},]" , "[{id:1},{}]" , false);,
throws org.json.JSONException: Value at 1 is null. Maybe this exception is expected rather than NullPointerException?
The following lines does not throw anything:
JSONAssert.assertNotEquals("[{id:1},]" , "[{id:2},]" , true); // passJSONAssert.assertEquals("[{id:1},]" , "[{id:1},]" , true); // pass
These examples are related to invalid JSON strings, which are inspired by example from another issue #127 talking about the length of invalid JsonArray.
The following line,
JSONAssert.assertEquals("[{id:1},]" , "[{id:1},{}]" , true);
, which inputs an invalid JSON string "[{id:1},]" to assertEquals, will throwjava.lang.NullPointerException
. (I think the string is invalid because the JsonArray contains no more element after a comma.)By the way, the following line,
JSONAssert.assertEquals("[{id:1},]" , "[{id:1},{}]" , false);
, throwsorg.json.JSONException: Value at 1 is null
. Maybe this exception is expected rather than NullPointerException?The following lines does not throw anything:
JSONAssert.assertNotEquals("[{id:1},]" , "[{id:2},]" , true); // pass
JSONAssert.assertEquals("[{id:1},]" , "[{id:1},]" , true); // pass
These examples are related to invalid JSON strings, which are inspired by example from another issue #127 talking about the length of invalid JsonArray.