Affects Version/s: None
Fix Version/s: 4.2.3
spring-test for comparing json use external library called jsonassert.
This lib has several modes of comparing json:
- STRICT - Strict checking. Not extensible, and strict array ordering.
- LENIENT - Lenient checking. Extensible, and non-strict array ordering.
- NON_EXTENSIBLE - Non-extensible checking. Not extensible, and non-strict array ordering.
- STRICT_ORDER - Strict order checking. Extensible, and strict array ordering.
By default spring-test in method org.springframework.test.web.servlet.result.ContentResultMatchers#json use this library in mode LENIENT.
This mode is not strict enough. In situation when in your json new field has added, your tests not failed, so app that use API with this json can crash when try to deserialize this in some POJO!
Also this is not acceptable, when you want compare json in other useful modes, for example NON_EXTENSIBLE.
So it would be great if developers can specify which mode to use in comparisons.