Overview
MockMvc.applyDefaultResultActions(MvcResult)
currently applies default ResultMatcher
s before default ResultHandler
s. Consequently, if a ResultMatcher
fails, no ResultHandler
will be applied.
For example, in the following test, if alwaysExpect(content().string("Boom!"))
results in an exception, alwaysDo(print(System.err))
will never be applied, and the user will never see the expected debug output to help diagnose the problem.
@Test
void test() throws Exception {
standaloneSetup(new SimpleController())
.alwaysDo(print(System.err))
.alwaysExpect(content().string("Boom!"))
.build()
.perform(get("/"));
}
Deliverables
- [x] Ensure that default
ResultHandler
s are applied before defaultResultMatcher
s.