use of io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountRestrictionsDTO in project nem2-sdk-java by nemtech.
the class RestrictionAccountRepositoryOkHttpImplTest method shouldGetAccountRestrictions.
@Test
public void shouldGetAccountRestrictions() throws Exception {
Address address = Address.generateRandom(networkType);
AccountRestrictionsDTO dto = new AccountRestrictionsDTO();
dto.setAddress(address.encoded());
AccountRestrictionDTO restriction = new AccountRestrictionDTO();
restriction.setRestrictionFlags(AccountRestrictionFlagsEnum.NUMBER_32770);
restriction.setValues(Arrays.asList("9636553580561478212"));
dto.setRestrictions(Collections.singletonList(restriction));
dto.setVersion(1);
AccountRestrictionsInfoDTO info = new AccountRestrictionsInfoDTO();
info.setAccountRestrictions(dto);
mockRemoteCall(info);
AccountRestrictions accountRestrictions = repository.getAccountRestrictions(address).toFuture().get();
Assertions.assertEquals(address, accountRestrictions.getAddress());
Assertions.assertEquals(1, accountRestrictions.getRestrictions().size());
Assertions.assertEquals(AccountMosaicRestrictionFlags.BLOCK_MOSAIC, accountRestrictions.getRestrictions().get(0).getRestrictionFlags());
Assertions.assertEquals(Arrays.asList(MapperUtils.toMosaicId("9636553580561478212")), accountRestrictions.getRestrictions().get(0).getValues());
}
use of io.nem.symbol.sdk.openapi.okhttp_gson.model.AccountRestrictionsDTO in project nem2-sdk-java by nemtech.
the class RestrictionAccountRepositoryOkHttpImplTest method search.
@Test
public void search() throws Exception {
Address address = Address.generateRandom(this.networkType);
AccountRestrictionsDTO dto = new AccountRestrictionsDTO();
dto.setAddress(address.encoded());
AccountRestrictionDTO restriction = new AccountRestrictionDTO();
restriction.setRestrictionFlags(AccountRestrictionFlagsEnum.NUMBER_32770);
restriction.setValues(Collections.singletonList("9636553580561478212"));
dto.setRestrictions(Collections.singletonList(restriction));
dto.setVersion(1);
AccountRestrictionsInfoDTO info = new AccountRestrictionsInfoDTO();
info.setAccountRestrictions(dto);
mockRemoteCall(toPage(info));
AccountRestrictions accountRestrictions = repository.search(new AccountRestrictionSearchCriteria()).toFuture().get().getData().get(0);
Assertions.assertEquals(address, accountRestrictions.getAddress());
Assertions.assertEquals(1, accountRestrictions.getRestrictions().size());
Assertions.assertEquals(AccountMosaicRestrictionFlags.BLOCK_MOSAIC, accountRestrictions.getRestrictions().get(0).getRestrictionFlags());
Assertions.assertEquals(Collections.singletonList(MapperUtils.toMosaicId("9636553580561478212")), accountRestrictions.getRestrictions().get(0).getValues());
}
Aggregations