MailController { @PostMapping("send") @SuppressWarnings("AssignmentToMethodParameter") public String send(@RequestParam("title") String title, @RequestParam("to") String to, @RequestParam("content") String content, Authentication authentication) { String userId = authentication != null ? authentication.getName() : null; if (!StringUtils.hasText(title)) { title = "No Topic"; } if (content.length() > 40000) { throw new BusinessException(BusinessCode.MAIL_CONTENT_LONG); } accountService.findOne(to); mailMapper.save(Mail.builder() .from(userId) .to(to) .title(title) .content(content) .build()); return "mails/sendsuccess"; }  @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 testSend() throws Exception { log.info("send"); String userId = mockDataService.user().getId(); String title = "title"; String to = mockDataService.user().getId(); String content = "content"; MvcResult result = mvc.perform(post("/send").with(user(userId)) .param("title", title) .param("to", to) .param("content", content)) .andExpect(status().isOk()) .andExpect(view().name("mails/sendsuccess")) .andReturn(); }