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

Verify a field is not present? #56

Open
hjohn opened this issue May 6, 2021 · 1 comment
Open

Verify a field is not present? #56

hjohn opened this issue May 6, 2021 · 1 comment
Labels
dependencies Pull requests that update a dependency file

Comments

@hjohn
Copy link

hjohn commented May 6, 2021

I'm trying to check if a field is not present, but none of these work:

 JsonAssertion.assertThat("{}").field("targetId").isEmpty();
 JsonAssertion.assertThat("{}").field("targetId").isNull();

They just result in:

 com.jayway.jsonpath.PathNotFoundException: No results for path: $['targetId']

Is there a way?

@marcingrzejszczak
Copy link
Owner

You can't test such things with JSON path. We could do it via code, however we wanted to maintain feature parity with JSON Path as such. Pull requests are welcome though

@marcingrzejszczak marcingrzejszczak added the dependencies Pull requests that update a dependency file label May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

2 participants