### Question:
AlertGroupService extends BaseService { public Map<String, Object> updateAlertgroup(User loginUser, int id, String groupName, AlertType groupType, String desc) { Map<String, Object> result = new HashMap<>(); if (checkAdmin(loginUser, result)){ return result; } AlertGroup alertGroup = alertGroupMapper.selectById(id); if (alertGroup == null) { putMsg(result, Status.ALERT_GROUP_NOT_EXIST); return result; } Date now = new Date(); if (StringUtils.isNotEmpty(groupName)) { alertGroup.setGroupName(groupName); } if (groupType != null) { alertGroup.setGroupType(groupType); } alertGroup.setDescription(desc); alertGroup.setUpdateTime(now); alertGroupMapper.updateById(alertGroup); putMsg(result, Status.SUCCESS); 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 testUpdateAlertgroup(){ User user = new User(); Map<String, Object> result = alertGroupService.updateAlertgroup(user,1,groupName, AlertType.SMS,groupName); logger.info(result.toString()); Assert.assertEquals(Status.USER_NO_OPERATION_PERM,result.get(Constants.STATUS)); user.setUserType(UserType.ADMIN_USER); result = alertGroupService.updateAlertgroup(user,1,groupName, AlertType.SMS,groupName); logger.info(result.toString()); Assert.assertEquals(Status.ALERT_GROUP_NOT_EXIST,result.get(Constants.STATUS)); Mockito.when(alertGroupMapper.selectById(2)).thenReturn(getEntity()); result = alertGroupService.updateAlertgroup(user,2,groupName, AlertType.SMS,groupName); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS,result.get(Constants.STATUS)); }