@FunctionalInterface public interface ResultMatcher
ResultMatcher matches the result of an executed request against
some expectation.
See static factory methods in
MockMvcResultMatchers.
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*;
// ...
WebApplicationContext wac = ...;
MockMvc mockMvc = webAppContextSetup(wac).build();
mockMvc.perform(get("/form"))
.andExpectAll(
status().isOk(),
content().mimeType(MediaType.APPLICATION_JSON));
| Modifier and Type | Method and Description |
|---|---|
void |
match(MvcResult result)
Assert the result of an executed request.
|
static ResultMatcher |
matchAll(ResultMatcher... matchers)
Deprecated.
as of Spring Framework 5.3.10, in favor of
ResultActions.andExpectAll(ResultMatcher...) |
void match(MvcResult result) throws Exception
result - the result of the executed requestException - if a failure occurs@Deprecated static ResultMatcher matchAll(ResultMatcher... matchers)
ResultActions.andExpectAll(ResultMatcher...)matchers - the matchers