skyscreamer / JSONassert

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

Include expected and actual in error message when arrays are not the same size. #108

Open 60secs opened 6 years ago

60secs commented 6 years ago

Desired: failure message includes expected and actual json

Actual: Error message only says they aren't the same size.

see: https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/comparator/DefaultComparator.java#L74

https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/test/java/org/skyscreamer/jsonassert/JSONCompareTest.java#L43

carterpage commented 2 years ago

The purpose of the error message is a succinct explanation. This small change could cause the results to blow up if the array contains many massive JSONObjects. Why not suggest that the invoking test prints the array contents on fail if that's what they want?

Open to more discussion but current inclination is to close as WAI.