MailController { @GetMapping({"sendpage", "send"}) @SuppressWarnings("AssignmentToMethodParameter") public String sendPage(Model model, @RequestParam(value = "reply", defaultValue = "-1") long reply, @RequestParam(value = "to", defaultValue = "") String userId, Authentication authentication) { String title = ""; String content = ""; if (reply != -1) { Mail parent = mailMapper.findOne(reply); if (parent == null) { throw new BusinessException(BusinessCode.MAIL_NOT_FOUND); } String toUser = parent.getTo(); if (!UserDetailsServiceImpl.isUser(authentication, toUser)) { throw new BusinessException(BusinessCode.MAIL_INVALID_ACCESS); } userId = parent.getFrom(); title = parent.getTitle(); content = parent.getContent(); if (!title.regionMatches(true, 0, "re:", 0, 3)) { title = "Re:" + title; } mailMapper.setReply(reply); } model.addAttribute("to", userId); model.addAttribute("title", title); model.addAttribute("content", JudgeUtils.INSTANCE.getReplyString(content)); return "mails/sendpage"; }  @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 testSendPage() throws Exception { log.info("sendPage"); long reply = -1; String to = mockDataService.user().getId(); String userId = mockDataService.user().getId(); MvcResult result = mvc.perform(get("/sendpage").with(user(userId)) .param("reply", Long.toString(reply)) .param("to", to)) .andExpect(status().isOk()) .andExpect(view().name("mails/sendpage")) .andReturn(); }