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

Provide a "formatted as string" comparison mode #174

Open
digulla opened this issue May 25, 2023 · 0 comments
Open

Provide a "formatted as string" comparison mode #174

digulla opened this issue May 25, 2023 · 0 comments

Comments

@digulla
Copy link

digulla commented May 25, 2023

I often need to compare the output of some REST API endpoint against a "known correct result" file.

This allows me to share the file with business, QAs and customers to get early feedback. It also helps them to keep track of changes since they get to see the current result without having to deploy and run the application.

For this to be efficient, I need a way to update the file when the output changes.

With the current implementation of JSONassert, this isn't efficient since I have to parse the error message myself, find the location in the file and then copy&paste every change myself.

My approach would be much more efficient if JSONassert would format both JSON trees into strings and then would call assertEquals() on them. JUnit handles this with a special ComparisonFailure which will allow the IDE to show a textual diff. That way, I can see all difference at once and compare them side by side. If the actual output looks correct, I can simply "Select All" and paste the new content into the file.

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

No branches or pull requests

1 participant