ManageReservationController { @TransactionTokenCheck(value = "update", type = TransactionTokenType.IN) @RequestMapping(value = "{reserveNo}/update", method = RequestMethod.POST) public String update(@PathVariable("reserveNo") String reserveNo, @Validated ManageReservationForm form, BindingResult result, Model model, RedirectAttributes redirectAttr) { if (result.hasErrors()) { return updateRedo(reserveNo, form, model); } ReservationUpdateInput input = beanMapper.map(form, ReservationUpdateInput.class); input.setReserveNo(reserveNo); ReservationUpdateOutput output = reserveService.update(input); redirectAttr.addFlashAttribute("output", output); return "redirect:/reservations/{reserveNo}/update?complete"; }  @ModelAttribute ManageReservationForm setUpManageReservationForm(); @RequestMapping(value = "me", method = RequestMethod.GET) String list(
            @AuthenticationPrincipal ReservationUserDetails userDetails,
            Model model); @RequestMapping(value = "{reserveNo}", method = RequestMethod.GET) String detailForm(@PathVariable("reserveNo") String reserveNo,
            Model model); @RequestMapping(value = "{reserveNo}/update", method = RequestMethod.GET, params = "form") String updateForm(@PathVariable("reserveNo") String reserveNo,
            ManageReservationForm form, Model model); @RequestMapping(value = "{reserveNo}/update", method = RequestMethod.POST, params = "redo") String updateRedo(@PathVariable("reserveNo") String reserveNo,
            ManageReservationForm form, Model model); @TransactionTokenCheck(value = "update", type = TransactionTokenType.BEGIN) @RequestMapping(value = "{reserveNo}/update", method = RequestMethod.POST, params = "confirm") String updateConfirm(@PathVariable("reserveNo") String reserveNo,
            @Validated ManageReservationForm form, BindingResult result,
            Model model); @TransactionTokenCheck(value = "update", type = TransactionTokenType.IN) @RequestMapping(value = "{reserveNo}/update", method = RequestMethod.POST) String update(@PathVariable("reserveNo") String reserveNo,
            @Validated ManageReservationForm form, BindingResult result,
            Model model, RedirectAttributes redirectAttr); @RequestMapping(value = "{reserveNo}/update", method = RequestMethod.GET, params = "complete") String updateComplete(); @RequestMapping(value = "{reserveNo}/update", method = RequestMethod.POST, params = "backTolist") String updateBackList(); @TransactionTokenCheck(value = "cancel", type = TransactionTokenType.BEGIN) @RequestMapping(value = "{reserveNo}/cancel", method = RequestMethod.GET) String cancelConfirm(@PathVariable("reserveNo") String reserveNo,
            Model model); @TransactionTokenCheck(value = "cancel", type = TransactionTokenType.IN) @RequestMapping(value = "{reserveNo}/cancel", method = RequestMethod.POST) String cancel(@PathVariable("reserveNo") String reserveNo,
            Model model, RedirectAttributes redirectAttr); @RequestMapping(value = "{reserveNo}/cancel", method = RequestMethod.GET, params = "complete") String cancelComplete(@PathVariable("reserveNo") String reserveNo,
            Model model); @RequestMapping(value = "{reserveNo}/cancel", method = RequestMethod.POST, params = "backTolist") String backList(); @RequestMapping(value = "{reserveNo}/pdf", method = RequestMethod.GET) String downloadPDF(@PathVariable("reserveNo") String reserveNo,
            Model model, Locale locale);  }
@Test public void testManageReservationUpdateSuccess() { MockHttpServletRequestBuilder postRequest = MockMvcRequestBuilders.post( "/reservations/123/update"); when(reserveService.update(any(ReservationUpdateInput.class))) .thenReturn(new ReservationUpdateOutput()); postRequest.param("reserveNo", "123"); postRequest.param("adultCount", "1"); postRequest.param("childCount", "2"); try { ResultActions results = mockMvc.perform(postRequest); results.andExpect(status().isFound()); results.andExpect(view().name( "redirect:/reservations/{reserveNo}/update?complete")); results.andExpect(flash().attribute("output", notNullValue())); return; } catch (Exception e) { e.printStackTrace(); } fail(); }