接口 ResultMatcher
- 函数接口:
- 这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。
A
ResultMatcher 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 cn.taketoday.test.web.servlet.request.MockMvcRequestBuilders.*;
import static cn.taketoday.test.web.servlet.result.MockMvcResultMatchers.*;
import static cn.taketoday.test.web.servlet.setup.MockMvcBuilders.*;
// ...
WebApplicationContext wac = ...;
MockMvc mockMvc = webAppContextSetup(wac).build();
mockMvc.perform(get("/form"))
.andExpectAll(
status().isOk(),
content().mimeType(MediaType.APPLICATION_JSON));
- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev, Sam Brannen
-
方法概要
修饰符和类型方法说明voidAssert the result of an executed request.static ResultMatchermatchAll(ResultMatcher... matchers) Static method for matching with an array of result matchers.
-
方法详细资料
-
match
Assert the result of an executed request.- 参数:
result- the result of the executed request- 抛出:
Exception- if a failure occurs
-
matchAll
Static method for matching with an array of result matchers.- 参数:
matchers- the matchers
-