### Question:
AlertGroupService extends BaseService { public Map<String, Object> createAlertgroup(User loginUser, String groupName, AlertType groupType, String desc) { Map<String, Object> result = new HashMap<>(); if (checkAdmin(loginUser, result)){ return result; } AlertGroup alertGroup = new AlertGroup(); Date now = new Date(); alertGroup.setGroupName(groupName); alertGroup.setGroupType(groupType); alertGroup.setDescription(desc); alertGroup.setCreateTime(now); alertGroup.setUpdateTime(now); int insert = alertGroupMapper.insert(alertGroup); if (insert > 0) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.CREATE_ALERT_GROUP_ERROR); } return result; }  HashMap<String, Object> queryAlertgroup(); Map<String, Object> listPaging(User loginUser, String searchVal, Integer pageNo, Integer pageSize); Map<String, Object> createAlertgroup(User loginUser, String groupName, AlertType groupType, String desc); Map<String, Object> updateAlertgroup(User loginUser, int id, String groupName, AlertType groupType, String desc); @Transactional(rollbackFor = RuntimeException.class) Map<String, Object> delAlertgroupById(User loginUser, int id); Map<String, Object> grantUser(User loginUser, int alertgroupId, String userIds); boolean existGroupName(String groupName);  }### Answer:
@Test public void testCreateAlertgroup(){ Mockito.when(alertGroupMapper.insert(any(AlertGroup.class))).thenReturn(2); User user = new User(); Map<String, Object> result = alertGroupService.createAlertgroup(user,groupName, AlertType.EMAIL,groupName); logger.info(result.toString()); Assert.assertEquals(Status.USER_NO_OPERATION_PERM,result.get(Constants.STATUS)); user.setUserType(UserType.ADMIN_USER); result = alertGroupService.createAlertgroup(user,groupName, AlertType.EMAIL,groupName); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS,result.get(Constants.STATUS)); }