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

Ease assertions on content of JSON files #567

Closed
fstaudt opened this issue Oct 23, 2022 · 1 comment
Closed

Ease assertions on content of JSON files #567

fstaudt opened this issue Oct 23, 2022 · 1 comment

Comments

@fstaudt
Copy link

fstaudt commented Oct 23, 2022

Is your feature request related to a problem? Please describe.
There is no simple way provided by json-unit-assertj module to assert JSON directly from a JSON file.
It is always required to read the file content before we can use assertThatJson.

Describe the solution you'd like
Logic to parse a JSON file should be encapsulated in a new class (e.g. JsonFileAssert).

This class should only read the file and delegate JSON assertions on file content to ConfigurableJsonAssert (e.g. hasContent()):

assertThatJsonFile(File("file.json")).hasContent().node("key").isEqualTo("value");

Describe alternatives you've considered
N/A

Additional context
I can provide a PR for this change

fstaudt added a commit to fstaudt/JsonUnit that referenced this issue Oct 23, 2022
@lukas-krecan
Copy link
Owner

Hi, sorry for the late response. I do not think this belongs to the library. It's straigtforward to implement on your side and it would bloat the API unnecesarilly.

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

2 participants