### Question:
MongoCompensationServiceImpl implements CompensationService { @Override public CommonPager<TccCompensationVO> listByPage(final CompensationQuery query) { CommonPager<TccCompensationVO> voCommonPager = new CommonPager<>(); final String mongoTableName = RepositoryPathUtils.buildMongoTableName(query.getApplicationName()); final PageParameter pageParameter = query.getPageParameter(); final int pageSize = pageParameter.getPageSize(); Query baseQuery = new Query(); if (StringUtils.isNoneBlank(query.getTransId())) { baseQuery.addCriteria(new Criteria("transId").is(query.getTransId())); } if (Objects.nonNull(query.getRetry())) { baseQuery.addCriteria(new Criteria("retriedCount").lt(query.getRetry())); } final long totalCount = mongoTemplate.count(baseQuery, mongoTableName); if (totalCount <= 0) { return voCommonPager; } final int currentPage = pageParameter.getCurrentPage(); int start = (currentPage - 1) * pageSize; voCommonPager.setPage(PageHelper.buildPage(query.getPageParameter(), (int) totalCount)); baseQuery.skip(start).limit(pageSize); final List<MongoAdapter> mongoAdapters = mongoTemplate.find(baseQuery, MongoAdapter.class, mongoTableName); if (CollectionUtils.isNotEmpty(mongoAdapters)) { final List<TccCompensationVO> recoverVOS = mongoAdapters.stream().map(ConvertHelper::buildVO) .collect(Collectors.toList()); voCommonPager.setDataList(recoverVOS); } return voCommonPager; } MongoCompensationServiceImpl(MongoTemplate mongoTemplate); @Override CommonPager<TccCompensationVO> listByPage(final CompensationQuery query); @Override Boolean batchRemove(final List<String> ids, final String applicationName); @Override Boolean updateRetry(final String id, final Integer retry, final String appName);  }### Answer:
@Test public void listByPage() throws Exception { CompensationQuery query = new CompensationQuery(); query.setApplicationName("alipay-service"); PageParameter pageParameter = new PageParameter(1, 5); query.setPageParameter(pageParameter); final CommonPager<TccCompensationVO> voCommonPager = compensationService.listByPage(query); Assert.assertNotNull(voCommonPager.getDataList()); }