I'm using org.json
to convert XML to JSON and I want to unit test (using JUnit
) my parsing process.
However, when I try to compare the objects using json.equals
it fails. I understand that jackson
has implemented the equals
method properly. Is there a way to unit test the equality of the objects with org.json
?
...
JSONObject actual = XML.toJSONObject(xml);
JSONObject expected = new JSONObject().put("key","val");
assertEquals(expected, actual); // false
assertEquals(expected.toString(), actual.toString()) // true