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

Introduce consumeWith() methods in WebTestClient assertions [SPR-16574] #21116

Closed
spring-projects-issues opened this issue Mar 9, 2018 · 1 comment
Assignees
Labels
in: test type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Mar 9, 2018

Sam Brannen opened SPR-16574 and commented

In order to make it easier for developers to provide custom assertions when using WebTestClient, it would be beneficial to introduce dedicated consumeWith(...) methods in assertion classes such as JsonPathAssertions, HeaderAssertions, StatusAssertions, etc.

For a concrete use case, consider that you want to assert that a given evaluated JsonPath contains a specific substring. With MockMvc that's easy due to the support for Hamcrest matchers. However, with WebTestClient users have to jump through hoops to implement something as simple as containsString(...). See the linked Stack Overflow discussion for additional details.


Affects: 5.0 GA

Reference URL: https://stackoverflow.com/questions/49149376/webtestclient-check-that-jsonpath-contains-sub-string

Issue Links:

  • #21270 WebTestClient does not provide Hamcrest Matcher assertions for JSONPath
@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jul 21, 2018

Rossen Stoyanchev commented

There are now both Consumer and hamcrest Matcher methods throughout the WebTestClient API.

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

No branches or pull requests

2 participants