Skip to content

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

@spring-projects-issues

Description

@spring-projects-issues

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:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions