With MockMvc
, you cannot. MockMvc
is a type of HTTP client. You generate your HTTP request with the MockMvcRequestBuilders
, setup your headers, request parameters, body, and URL. MockMvc
will mock sending the request integrating the full DispatcherServlet
stack.
If you want to mock the BindingResult
argument, I suggest you test your @Controller
class independently.
// in @Test
MyController controller = new MyController(/* maybe other arguments */)
// generate your mocks and declare expectations
controller.addEvent(/* mocks go here */);
// verify your mocks