When a browser needs to submit a form, it typically serializes the form <input>
fields as url-encoded parameters. Therefore, when you want to mock an HttpServletRequest
, you need to add those same parameters to the request.
request.param("name", "some value")
.param("description", "description value")
.param("date", "some acceptable representation of date");
The DispatcherServlet
will use these parameters to create a Vacancy
instance to pass as an argument to your handler method.