### Question:
UsersService extends BaseService { public Result verifyUserName(String userName) { Result result = new Result(); User user = userMapper.queryByUserNameAccurately(userName); if (user != null) { logger.error("user {} has exist, can't create again.", userName); putMsg(result, Status.USER_NAME_EXIST); } else { putMsg(result, Status.SUCCESS); } return result; }  @Transactional(rollbackFor = Exception.class) Map<String, Object> createUser(User loginUser,
                                          String userName,
                                          String userPassword,
                                          String email,
                                          int tenantId,
                                          String phone,
                                          String queue,
                                          int state); @Transactional(rollbackFor = RuntimeException.class) User createUser(String userName,
                                          String userPassword,
                                          String email,
                                          int tenantId,
                                          String phone,
                                          String queue,
                                          int state); User queryUser(int id); User queryUser(String name); User queryUser(String name, String password); int getUserIdByName(String name); Map<String, Object> queryUserList(User loginUser, String searchVal, Integer pageNo, Integer pageSize); Map<String, Object> updateUser(int userId,
                                          String userName,
                                          String userPassword,
                                          String email,
                                          int tenantId,
                                          String phone,
                                          String queue,
                                          int state); Map<String, Object> deleteUserById(User loginUser, int id); @Transactional(rollbackFor = RuntimeException.class) Map<String, Object> grantProject(User loginUser, int userId, String projectIds); @Transactional(rollbackFor = RuntimeException.class) Map<String, Object> grantResources(User loginUser, int userId, String resourceIds); @Transactional(rollbackFor = RuntimeException.class) Map<String, Object> grantUDFFunction(User loginUser, int userId, String udfIds); @Transactional(rollbackFor = RuntimeException.class) Map<String, Object> grantDataSource(User loginUser, int userId, String datasourceIds); Map<String, Object> getUserInfo(User loginUser); Map<String, Object> queryAllGeneralUsers(User loginUser); Map<String, Object> queryUserList(User loginUser); Result verifyUserName(String userName); Map<String, Object> unauthorizedUser(User loginUser, Integer alertgroupId); Map<String, Object> authorizedUser(User loginUser, Integer alertgroupId); @Transactional(rollbackFor = RuntimeException.class) Map<String, Object> registerUser(String userName, String userPassword, String repeatPassword, String email); Map<String, Object> activateUser(User loginUser, String userName); Map<String, Object> batchActivateUser(User loginUser, List<String> userNames);  }### Answer:
@Test public void testVerifyUserName(){ Result result = usersService.verifyUserName("admin89899"); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS.getMsg(), result.getMsg()); when(userMapper.queryByUserNameAccurately("userTest0001")).thenReturn(getUser()); result = usersService.verifyUserName("userTest0001"); logger.info(result.toString()); Assert.assertEquals(Status.USER_NAME_EXIST.getMsg(), result.getMsg()); }