RegisterController { @PostMapping("register") @SuppressWarnings("AssignmentToMethodParameter") public String register( HttpServletRequest request, @RequestParam("user_id") String userId, @RequestParam("school") String school, @RequestParam("nick") String nick, @RequestParam("password") String password, @RequestParam("email") String email, @RequestParam("rptPassword") String rptPassword) { contestOnlyService.checkRegister(); ValueCheck.checkUserId(userId); ValueCheck.checkPassword(password); ValueCheck.checkEmail(email); if (!Objects.equals(password, rptPassword)) { throw new BusinessException(BusinessCode.REPEAT_PASSWORD_MISMATCH); } if (StringUtils.hasText(nick)) { nick = nick.trim(); } else { nick = userId; } ValueCheck.checkNick(nick); if (userMapper.findOne(userId) != null) { throw new BusinessException(BusinessCode.IMPORT_USER_EXISTS, userId); } User user = User.builder().id(userId) .password(passwordEncoder.encode(password)) .email(StringUtils.isEmpty(email) ? null : email) .nick(nick) .school(school) .ip(request.getRemoteAddr()) .build(); userMapper.save(user); log.info("{}", user); request.setAttribute("user", user); return "users/registerSuccess"; }  @PostMapping("register") @SuppressWarnings("AssignmentToMethodParameter") String register(
            HttpServletRequest request,
            @RequestParam("user_id") String userId,
            @RequestParam("school") String school,
            @RequestParam("nick") String nick,
            @RequestParam("password") String password,
            @RequestParam("email") String email,
            @RequestParam("rptPassword") String rptPassword);  }
@Test public void testRegister() throws Exception { log.info("register"); String userId = mockDataService.user(false).getId(); String school = ""; String nick = ""; String password = userId; String email = ""; String rptPassword = password; MvcResult result = mvc.perform(post("/register") .param("user_id", userId) .param("school", school) .param("nick", nick) .param("password", password) .param("email", email) .param("rptPassword", rptPassword)) .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_HTML)) .andExpect(view().name("users/registerSuccess")) .andReturn(); }