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

JSONAssert.assertEquels passes when expected empty json and received a non empty one #72

Open DinaWork opened 7 years ago

DinaWork commented 7 years ago

JSONAssert.assertEquals("{}", "{a:123}", false); // passes

A note: JSONAssert.assertEquals("{a:123}","{}", false); and JSONAssert.assertEquals("{}", "{a:123}", true); do throw an exception

yasin3061 commented 7 years ago

This is because you have disabled the strict mode. This means that the actual String can have 'lesser' fields than the expected fields. JSONAssert.assertEquals("{}", "{a:123}", true); should fail the test.

yasin3061 commented 7 years ago

@carterpage any comments on this one?