use of io.nem.symbol.sdk.openapi.vertx.model.TransferTransactionDTO in project nem2-sdk-java by nemtech.
the class TransactionMapperVertxTest method validateTransferTx.
void validateTransferTx(TransferTransaction transaction, TransactionInfoDTO transactionDTO) {
TransferTransactionDTO transferTransaction = jsonHelper.convert(transactionDTO.getTransaction(), TransferTransactionDTO.class);
assertEquals(MapperUtils.toUnresolvedAddress(transferTransaction.getRecipientAddress()), transaction.getRecipient());
List<UnresolvedMosaic> mosaicsDTO = transferTransaction.getMosaics();
if (mosaicsDTO != null && mosaicsDTO.size() > 0) {
assertEquals(MapperUtils.fromHexToBigInteger(mosaicsDTO.get(0).getId()), transaction.getMosaics().get(0).getId().getId());
assertEquals(mosaicsDTO.get(0).getAmount(), transaction.getMosaics().get(0).getAmount());
}
if (StringUtils.isEmpty(transferTransaction.getMessage())) {
assertFalse(transaction.getMessage().isPresent());
} else if (transaction.getMessage().get().getText().isEmpty()) {
assertEquals("", transaction.getMessage().get().getText());
} else {
assertEquals(new String(ConvertUtils.fromHexToBytes(transferTransaction.getMessage().substring(2)), StandardCharsets.UTF_8), transaction.getMessage().get().getText());
}
}
Aggregations