Skip to content
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

Make test more stable by using JSONAssert equals #1541

Merged
merged 1 commit into from
Jan 30, 2020

Conversation

contextshuffling
Copy link
Contributor

Tests in test/org/nutz/json/JsonTest.java compares toJson results with several hard-coded strings.

However, the toJSON function depends on getDeclaredField which does not guarantee any specific order, thus resulting a different serialized json string. So tests may fail or pass without any changes made to the source code and cannot serve as good regression tests.

This PR proposes to use JSONAssert and change test assertions to check JSON results in a safer way.

@contextshuffling
Copy link
Contributor Author

CI failed but it looks like it is due to flakyness in HttpTest itself, which is not related to this change

@wendal wendal merged commit d4694e7 into nutzam:master Jan 30, 2020
@wendal
Copy link
Member

wendal commented Jan 30, 2020

thank you very much ^_^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants