title: SpringMVC testing post method with params
body: <p>I'm writing test for SpringMvc app, and i've run into some issue.</p>
  
  <p>here is my controller method for test:</p>
  
  <pre><code>@RequestMapping(value = "submit", method = RequestMethod.POST, params = "delete")
  public String delete(@ModelAttribute("inputBean") InputBean inputBean) {
      Book book = (Book) itemServiceController.getItemFindByIdService().findById(inputBean.getId());
      Author author = getAuthorOfBook(book);
      author.getBookList().remove(book);
      authorServiceController.getAuthorCreateService().create(authorServiceController.getAuthorUpdateService().update(author));
      itemServiceController.getItemDeleteService().delete(inputBean.getId());
      return "redirect:index.html";
  }
  </code></pre>
  
  <p>here is my mockMvc:</p>
  
  <pre><code>mockMvc.perform(post("/submit?delete")
              .contentType(MediaType.APPLICATION_FORM_URLENCODED)
              .param("id", "1")
              .sessionAttr("inputBean", new InputBean())
              )
      .andExpect(status().isOk())
      .andExpect(view().name("indexLib"))
      .andExpect(model().attribute("inputBean", hasProperty("id", is(1))));
  </code></pre>
  
  <p>This returns status http status 400.</p>
  
  <p>Controller method is made for 1 of 4 form submit buttons. How to fix this?</p>