Interface ResultMatcher
public interface ResultMatcher
AResultMatcher
matches the result of an executed request against some expectation.See static factory methods in
MockMvcResultMatchers
.Example Using Status and Content Result Matchers
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));
- Since:
- 3.2
- Author:
- Rossen Stoyanchev, Sam Brannen
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
match(MvcResult result)
Assert the result of an executed request.