use of io.nem.symbol.sdk.api.MosaicSearchCriteria in project nem2-sdk-java by nemtech.
the class MosaicRepositoryIntegrationTest method searchUsingOffset.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void searchUsingOffset(RepositoryType type) {
MosaicRepository mosaicRepository = getMosaicRepository(type);
MosaicPaginationStreamer streamer = new MosaicPaginationStreamer(mosaicRepository);
MosaicSearchCriteria criteria = new MosaicSearchCriteria();
criteria.setPageSize(10);
int offsetIndex = 2;
List<MosaicInfo> mosaicsWithoutOffset = get(streamer.search(criteria).toList().toObservable());
criteria.setOffset(mosaicsWithoutOffset.get(offsetIndex).getRecordId().get());
List<MosaicInfo> mosaicFromOffsets = get(streamer.search(criteria).toList().toObservable());
PaginationTester.sameEntities(mosaicsWithoutOffset.stream().skip(offsetIndex + 1).collect(Collectors.toList()), mosaicFromOffsets);
}
Aggregations