@FunctionalInterface
public interface ResultHandler
ResultHandler
performs a generic action on the result of an
executed request — for example, printing debug information.
See static factory methods in
MockMvcResultHandlers
.
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.*; import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*; // ... WebApplicationContext wac = ...; MockMvc mockMvc = webAppContextSetup(wac).build(); mockMvc.perform(get("/form")).andDo(print());
Modifier and Type | Method and Description |
---|---|
void |
handle(MvcResult result)
Perform an action on the given result.
|
void handle(MvcResult result) throws java.lang.Exception
result
- the result of the executed requestjava.lang.Exception
- if a failure occurs