@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"))
.andExpect(status().isOk())
.andExpect(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)
Static method for matching with an array of result matchers.
|
void match(MvcResult result) throws Exception
result - the result of the executed requestException - if a failure occursstatic ResultMatcher matchAll(ResultMatcher... matchers)
matchers - the matchers