Witam,
Piszę sobie właśnie testy jednostkowe do apki w springu mvc, i generalnie mam takie pytanie, które zapewne jest trywialne ale nie mogę go przeskoczyć.
Więc, mam taką metodę kontrollera:
@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";
}
Co muszę podać w mockMvc.perform(post("/submit")) żeby odniosło mi sie do tej metody?
Podanie "/submit?delete" wyrzuca status 400.