Details
Description
Seems that the reactive WebTestClient is missing some valuable assertions that are available on MockMvc.
With MockMvc I can do things like
this.mockMvc.perform(get("/some/url")) .andExpect(jsonPath("$.someNestedObject.*", Matchers.hasSize(5))) .andExpect(jsonPath("$.someNestedObject.anotherObject").value(Matchers.startsWith("Some String")));
The WebTestClient.jsonPath method doesn't have an overloaded
jsonPath(String expression, Matcher<T> matcher)
method like its MockMvcResultMatchers counterpart does. Also JsonPathAssertions doesn't have an overloaded
value(Matcher<T> matcher)
method like its JsonPathResultMatchers counterpart does. Under the covers both JsonPathResultMatchers & JsonPathAssertions utilize the exact same JsonPathExpectationsHelper which exposes the
public <T> void assertValue(String content, Matcher<T> matcher)
method which is needed.
Is there a particular reason this is missing or is it an oversight? Also seems that there is 0 support for assertions against XML using WebTestClient. Again, is there a specific reason as to why not?