skyscreamer / JSONassert

Write JSON unit tests in less code. Great for testing REST interfaces.
http://jsonassert.skyscreamer.org
Apache License 2.0
1k stars 197 forks source link

Problem comparing Integer and Long JSONObjects #24

Closed jcassee closed 11 years ago

jcassee commented 11 years ago

In order to test a JSON API I am using JSONAssert. The actual and expected output are already JSONObject objects, so I am just comparing them:

JSONObject expected = new JSONObject(expectedString);
JSONAssert.assertEquals(expected, actual, false);

However, one of the properties in the actual object are Longs, while the created expected object uses Integers. The solution I came up with is to convert the actual object to a string and use this:

JSONAssert.assertEquals(expectedString, actual.toString(), false);

Possibly related to issue #23.

carterpage commented 11 years ago

Depends on #26.

carterpage commented 11 years ago

Fixed by #27. Will be released in 1.2.0 this month.

jcassee commented 11 years ago

Great, thanks Carter!