MailController { @GetMapping("deletemail") public String delete(@RequestParam("mail_id") long mailId, Authentication authentication) { access(mailId, authentication); mailMapper.delete(mailId); return "redirect:/mail"; }  @GetMapping("deletemail") String delete(@RequestParam("mail_id") long mailId, Authentication authentication); @GetMapping("mail") @SuppressWarnings("AssignmentToMethodParameter") String mail(Model model,
            @RequestParam(value = "size", defaultValue = "20") int size,
            @RequestParam(value = "start", defaultValue = "1") long start,
            Authentication authentication); @PostMapping("send") @SuppressWarnings("AssignmentToMethodParameter") String send(@RequestParam("title") String title,
            @RequestParam("to") String to,
            @RequestParam("content") String content,
            Authentication authentication); @GetMapping({"sendpage", "send"}) @SuppressWarnings("AssignmentToMethodParameter") String sendPage(Model model,
            @RequestParam(value = "reply", defaultValue = "-1") long reply,
            @RequestParam(value = "to", defaultValue = "") String userId,
            Authentication authentication); @GetMapping("showmail") String showMail(Model model,
            @RequestParam("mail_id") long mailId,
            Authentication authentication);  }
@Test public void testDelete() throws Exception { log.info("delete"); String userId = mockDataService.user().getId(); long mailId = newMail(mockDataService.user().getId(), userId).getId(); MvcResult result = mvc.perform(get("/deletemail").with(user(userId)) .param("mail_id", Long.toString(mailId))) .andExpect(status().isFound()) .andExpect(redirectedUrl("/mail")) .andReturn(); }