title: How to pass ModelAttrubute parameters using MockMvc?
body: <p>I have this html spring  form:</p>
  
  <pre><code>&lt;form:form action="addVacancy" modelAttribute="myVacancy"&gt;
          &lt;form:label path="name"&gt;name&lt;/form:label&gt;
          &lt;form:input path="name" &gt;&lt;/form:input&gt;
          &lt;form:errors path="name" cssClass="error" /&gt;
          &lt;br&gt;
          &lt;form:label path="description"&gt;description&lt;/form:label&gt;
          &lt;form:input path="description" id="nameInput"&gt;&lt;/form:input&gt;
          &lt;form:errors path="description" cssClass="error" /&gt;
          &lt;br&gt;
          &lt;form:label path="date"&gt;date&lt;/form:label&gt;
          &lt;input type="date" name="date" /&gt;
          &lt;form:errors path="date" cssClass="error" /&gt;
          &lt;br&gt;
          &lt;input type="submit" value="add" /&gt;
      &lt;/form:form&gt;
  </code></pre>
  
  <p>I handle this form by this method:</p>
  
  <pre><code>@RequestMapping("/addVacancy")
      public ModelAndView addVacancy(@ModelAttribute("myVacancy") @Valid Vacancy vacancy,BindingResult result, Model model,RedirectAttributes redirectAttributes){
          if(result.hasErrors()){
              model.addAttribute("message","validation error");
              return new ModelAndView("vacancyDetailsAdd");
          }
          vacancyService.add(vacancy);
          ModelAndView mv = new ModelAndView("redirect:goToVacancyDetails");
          mv.addObject("idVacancy", vacancy.getId());
          redirectAttributes.addAttribute("message", "added correctly at "+ new Date());
          return mv;
      }
  </code></pre>
  
  <p>How to make the same request, which is obtained after submitting the form. This must be done by means of MockMvc.</p>
  
  <pre><code>@Test
  public void testMethod(){
      MockHttpServletRequestBuilder request = MockMvcRequestBuilders.get("/addVacancy");
      //what must I  write here?
      ResultActions result = mockMvc.perform(request);
  }
  </code></pre>
  
  <p>I very confused.</p>