### Question:
AlertGroupService extends BaseService { public Map<String, Object> listPaging(User loginUser, String searchVal, Integer pageNo, Integer pageSize) { Map<String, Object> result = new HashMap<>(); if (checkAdmin(loginUser, result)) { return result; } Page<AlertGroup> page = new Page(pageNo, pageSize); IPage<AlertGroup> alertGroupIPage = alertGroupMapper.queryAlertGroupPage( page, searchVal); PageInfo<AlertGroup> pageInfo = new PageInfo<>(pageNo, pageSize); pageInfo.setTotalCount((int)alertGroupIPage.getTotal()); pageInfo.setLists(alertGroupIPage.getRecords()); result.put(Constants.DATA_LIST, pageInfo); 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 testListPaging(){ IPage<AlertGroup> page = new Page<>(1,10); page.setTotal(1L); page.setRecords(getList()); Mockito.when(alertGroupMapper.queryAlertGroupPage(any(Page.class),eq(groupName))).thenReturn(page); User user = new User(); Map<String, Object> result = alertGroupService.listPaging(user,groupName,1,10); logger.info(result.toString()); Assert.assertEquals(Status.USER_NO_OPERATION_PERM,result.get(Constants.STATUS)); user.setUserType(UserType.ADMIN_USER); result = alertGroupService.listPaging(user,groupName,1,10); logger.info(result.toString()); PageInfo<AlertGroup> pageInfo = (PageInfo<AlertGroup>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(pageInfo.getLists())); }