### Question:
AlertGroupService extends BaseService { @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> delAlertgroupById(User loginUser, int id) { Map<String, Object> result = new HashMap<>(); result.put(Constants.STATUS, false); if (checkAdmin(loginUser, result)){ return result; } AlertGroup alertGroup = alertGroupMapper.selectById(id); if (alertGroup == null) { putMsg(result, Status.ALERT_GROUP_NOT_EXIST); return result; } userAlertGroupService.deleteByAlertGroupId(id); alertGroupMapper.deleteById(id); 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 testDelAlertgroupById(){ User user = new User(); Map<String, Object> result = alertGroupService.delAlertgroupById(user,1); logger.info(result.toString()); Assert.assertEquals(Status.USER_NO_OPERATION_PERM,result.get(Constants.STATUS)); user.setUserType(UserType.ADMIN_USER); result = alertGroupService.delAlertgroupById(user,2); logger.info(result.toString()); Assert.assertEquals(Status.ALERT_GROUP_NOT_EXIST,result.get(Constants.STATUS)); Mockito.when(alertGroupMapper.selectById(2)).thenReturn(getEntity()); result = alertGroupService.delAlertgroupById(user,2); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS,result.get(Constants.STATUS)); }