@FunctionalInterfaceSE public interface ResultMatcher
ResultMatcher は、実行されたリクエストの結果を何らかの期待と照合します。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));
| 修飾子と型 | メソッドと説明 |
|---|---|
void | match(MvcResult result) 実行されたリクエストの結果をアサートします。 |
static ResultMatcher | matchAll(ResultMatcher... matchers) 使用すべきではありません。 Spring Framework 5.3.10 現在、 ResultActions.andExpectAll(ResultMatcher...) を推奨 |
void match(MvcResult result) throws ExceptionSE
result - 実行されたリクエストの結果 ExceptionSE - 障害が発生した場合 @DeprecatedSE static ResultMatcher matchAll(ResultMatcher... matchers)
ResultActions.andExpectAll(ResultMatcher...) に置き換えられました。matchers - マッチャー