use of io.nem.symbol.sdk.openapi.vertx.model.Mosaic in project nem2-sdk-java by nemtech.
the class AccountRepositoryVertxImplTest method shouldGetAccountInfo.
@Test
public void shouldGetAccountInfo() throws Exception {
Account account = Account.generateNewAccount(this.networkType);
Address address = account.getAddress();
AccountDTO accountDTO = new AccountDTO();
accountDTO.setVersion(1);
accountDTO.setAccountType(AccountTypeEnum.NUMBER_1);
accountDTO.setAddress(encodeAddress(address));
accountDTO.setAddressHeight(BigInteger.TEN);
accountDTO.setPublicKeyHeight(BigInteger.valueOf(20));
accountDTO.setPublicKey(account.getPublicAccount().getPublicKey().toHex());
accountDTO.setImportance(BigInteger.valueOf(5));
accountDTO.setImportanceHeight(BigInteger.valueOf(10));
List<Mosaic> mosaicDtos = new ArrayList<>();
mosaicDtos.add(new Mosaic().id("0000000000000ABC").amount(BigInteger.TEN));
accountDTO.setMosaics(mosaicDtos);
AccountInfoDTO accountInfoDTO = new AccountInfoDTO();
accountInfoDTO.setAccount(accountDTO);
mockRemoteCall(accountInfoDTO);
AccountInfo resolvedAccountInfo = repository.getAccountInfo(address).toFuture().get();
Assertions.assertEquals(address, resolvedAccountInfo.getAddress());
Assertions.assertEquals(AccountType.MAIN, resolvedAccountInfo.getAccountType());
Assertions.assertEquals(1, resolvedAccountInfo.getMosaics().size());
Assertions.assertEquals("0000000000000ABC", resolvedAccountInfo.getMosaics().get(0).getId().getIdAsHex());
Assertions.assertEquals(BigInteger.TEN, resolvedAccountInfo.getMosaics().get(0).getAmount());
}
Aggregations