use of io.nem.symbol.sdk.api.AccountPaginationStreamer in project nem2-sdk-java by nemtech.
the class AccountSearchRepositoryIntegrationTest method searchMosaicIdProvided.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void searchMosaicIdProvided(RepositoryType type) {
AccountPaginationStreamer streamer = new AccountPaginationStreamer(this.getAccountRepository(type));
RepositoryFactory repositoryFactory = getRepositoryFactory(type);
NamespaceId networkCurrencyId = get(repositoryFactory.getNetworkCurrency()).getNamespaceId().get();
Assertions.assertTrue(networkCurrencyId.getFullName().isPresent());
MosaicId mosaicId = get(repositoryFactory.createNamespaceRepository().getLinkedMosaicId(networkCurrencyId));
AccountSearchCriteria criteria = new AccountSearchCriteria().mosaicId(mosaicId);
List<AccountInfo> accounts = get(streamer.search(criteria).toList().toObservable());
Assertions.assertFalse(accounts.isEmpty());
System.out.println(toJson(accounts));
accounts.forEach(a -> {
Assertions.assertTrue(a.getMosaics().stream().filter(m -> m.getId().equals(mosaicId)).findFirst().get().getAmount().longValue() > 0);
});
}
Aggregations