New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add selection of compare mode for Json assertion [SPR-13607] #18185

Closed
spring-issuemaster opened this Issue Oct 25, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

spring-issuemaster commented Oct 25, 2015

Eugene Tenkaev opened SPR-13607 and commented

Greetings everyone!

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.


Referenced from: pull request #897, and commits 1d60a6a

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

spring-issuemaster commented Oct 25, 2015

Eugene Tenkaev commented

I suggest solving by making pull request #897

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment