Skip to content

Provide a "formatted as string" comparison mode #174

@digulla

Description

@digulla

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions