use of io.nem.symbol.sdk.api.MosaicRestrictionSearchCriteria in project nem2-sdk-java by nemtech.
the class MosaicRestrictionServiceIntegrationTest method getMosaicGlobalRestrictionWhenMosaicDoesNotExist.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getMosaicGlobalRestrictionWhenMosaicDoesNotExist(RepositoryType type) {
RestrictionMosaicRepository repository = getRepositoryFactory(type).createRestrictionMosaicRepository();
Address address = Address.createFromPublicKey("67F69FA4BFCD158F6E1AF1ABC82F725F5C5C4710D6E29217B12BE66397435DFB", getNetworkType());
Page<MosaicRestriction<?>> page = get(repository.search(new MosaicRestrictionSearchCriteria().mosaicId(new MosaicId(BigInteger.valueOf(888888))).targetAddress(address).entryType(MosaicRestrictionEntryType.GLOBAL)));
Assertions.assertTrue(page.getData().isEmpty());
}
use of io.nem.symbol.sdk.api.MosaicRestrictionSearchCriteria in project nem2-sdk-java by nemtech.
the class RestrictionMosaicRepositoryIntegrationTest method searchGlobalRestriction.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void searchGlobalRestriction(RepositoryType type) {
RepositoryFactory repositoryFactory = getRepositoryFactory(type);
RestrictionMosaicRepository repository = repositoryFactory.createRestrictionMosaicRepository();
MosaicRestrictionEntryType entryType = MosaicRestrictionEntryType.GLOBAL;
Page<MosaicRestriction<?>> page = get(repository.search(new MosaicRestrictionSearchCriteria().entryType(entryType)));
System.out.println(page.getData().size());
page.getData().forEach(restriction -> {
Assertions.assertTrue(restriction instanceof MosaicGlobalRestriction);
Assertions.assertEquals(entryType, restriction.getEntryType());
Assertions.assertNotNull(restriction.getMosaicId());
Assertions.assertNotNull(restriction.getCompositeHash());
Assertions.assertFalse(restriction.getRestrictions().isEmpty());
});
}
Aggregations