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

Better support for testing JSON [SPR-16737] #21278

Closed
spring-projects-issues opened this issue Apr 17, 2018 · 1 comment
Closed

Better support for testing JSON [SPR-16737] #21278

spring-projects-issues opened this issue Apr 17, 2018 · 1 comment
Assignees
Labels
in: test

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Apr 17, 2018

Kamil opened SPR-16737 and commented

Reactive WebTestClient is using JsonPath assertions like: ```
jsonPath("$[0]['gender']")


It would be so good, if you could provide "AssertJ like" fluent API to test JSONs...

Issue Links:

  • #21270 WebTestClient does not provide Hamcrest Matcher assertions for JSONPath

1 votes, 2 watchers

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Apr 20, 2018

Rossen Stoyanchev commented

WebTestClient supports JSONAssert for comparing full JSON content and JSONPath for extracting and matching specific values. Use whichever one you prefer or fits the case. Also the API is fluent so it's not clear what you mean. Perhaps there are other assertions you'd like to see? Please be more specific.

As an aside, at various places in the API, there are java.util.function.Consumer callbacks (e.g. test) that expose the underlying data. Those hooks can be used to plug any assertion library.

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

No branches or pull requests

2 participants