Search in sources :

Example 1 with BalanceTransferReceipt

use of io.nem.symbol.sdk.model.receipt.BalanceTransferReceipt in project nem2-sdk-java by nemtech.

the class ReceiptMappingOkHttpTest method getTransactionStatements2Recipients.

@Test
public void getTransactionStatements2Recipients() {
    List<TransactionStatementInfoDTO> transactionStatementInfoDTOS = jsonHelper.parseList(TestHelperOkHttp.loadResource("Recipient-TransactionResolutionStatement.json"), TransactionStatementInfoDTO.class);
    List<TransactionStatement> transactionStatements = transactionStatementInfoDTOS.stream().map(mapper::createTransactionStatement).collect(Collectors.toList());
    TransactionStatement transactionStatement = transactionStatements.get(1);
    Assertions.assertEquals("41BF730BD307EB507880CA0576A4CCEFEF95F3060DC334CA364AE737114D1F60", transactionStatement.generateHash().toUpperCase());
    List<Receipt> receipts = transactionStatement.getReceipts();
    Assertions.assertEquals(5, receipts.size());
    Assertions.assertEquals(ReceiptType.NAMESPACE_RENTAL_FEE, receipts.get(0).getType());
    Assertions.assertEquals("85BBEA6CC462B244", ((BalanceTransferReceipt) receipts.get(0)).getMosaicId().getIdAsHex());
    Assertions.assertEquals(ReceiptType.MOSAIC_EXPIRED, receipts.get(1).getType());
    Assertions.assertEquals(MosaicId.class, ((ArtifactExpiryReceipt) receipts.get(1)).getArtifactId().getClass());
    Assertions.assertEquals(ReceiptType.NAMESPACE_EXPIRED, receipts.get(2).getType());
    Assertions.assertEquals(NamespaceId.class, ((ArtifactExpiryReceipt) receipts.get(2)).getArtifactId().getClass());
    Assertions.assertEquals(ReceiptType.NAMESPACE_DELETED, receipts.get(3).getType());
    Assertions.assertEquals(NamespaceId.class, ((ArtifactExpiryReceipt) receipts.get(3)).getArtifactId().getClass());
    Assertions.assertEquals(ReceiptType.INFLATION, receipts.get(4).getType());
    Assertions.assertEquals(333, ((InflationReceipt) receipts.get(4)).getAmount().longValue());
}
Also used : BalanceTransferReceipt(io.nem.symbol.sdk.model.receipt.BalanceTransferReceipt) Receipt(io.nem.symbol.sdk.model.receipt.Receipt) ArtifactExpiryReceipt(io.nem.symbol.sdk.model.receipt.ArtifactExpiryReceipt) InflationReceipt(io.nem.symbol.sdk.model.receipt.InflationReceipt) InflationReceipt(io.nem.symbol.sdk.model.receipt.InflationReceipt) TransactionStatementInfoDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.TransactionStatementInfoDTO) ArtifactExpiryReceipt(io.nem.symbol.sdk.model.receipt.ArtifactExpiryReceipt) TransactionStatement(io.nem.symbol.sdk.model.receipt.TransactionStatement) BalanceTransferReceipt(io.nem.symbol.sdk.model.receipt.BalanceTransferReceipt) Test(org.junit.jupiter.api.Test)

Example 2 with BalanceTransferReceipt

use of io.nem.symbol.sdk.model.receipt.BalanceTransferReceipt in project nem2-sdk-java by nemtech.

the class ReceiptMappingVertxTest method getTransactionStatements2Recipients.

@Test
public void getTransactionStatements2Recipients() {
    List<TransactionStatementInfoDTO> transactionStatementInfoDTOS = jsonHelper.parseList(TestHelperVertx.loadResource("Recipient-TransactionResolutionStatement.json"), TransactionStatementInfoDTO.class);
    List<TransactionStatement> transactionStatements = transactionStatementInfoDTOS.stream().map(mapper::createTransactionStatement).collect(Collectors.toList());
    TransactionStatement transactionStatement = transactionStatements.get(1);
    Assertions.assertEquals("41BF730BD307EB507880CA0576A4CCEFEF95F3060DC334CA364AE737114D1F60", transactionStatement.generateHash().toUpperCase());
    List<Receipt> receipts = transactionStatement.getReceipts();
    Assertions.assertEquals(5, receipts.size());
    Assertions.assertEquals(ReceiptType.NAMESPACE_RENTAL_FEE, receipts.get(0).getType());
    Assertions.assertEquals("85BBEA6CC462B244", ((BalanceTransferReceipt) receipts.get(0)).getMosaicId().getIdAsHex());
    Assertions.assertEquals(ReceiptType.MOSAIC_EXPIRED, receipts.get(1).getType());
    Assertions.assertEquals(MosaicId.class, ((ArtifactExpiryReceipt) receipts.get(1)).getArtifactId().getClass());
    Assertions.assertEquals(ReceiptType.NAMESPACE_EXPIRED, receipts.get(2).getType());
    Assertions.assertEquals(NamespaceId.class, ((ArtifactExpiryReceipt) receipts.get(2)).getArtifactId().getClass());
    Assertions.assertEquals(ReceiptType.NAMESPACE_DELETED, receipts.get(3).getType());
    Assertions.assertEquals(NamespaceId.class, ((ArtifactExpiryReceipt) receipts.get(3)).getArtifactId().getClass());
    Assertions.assertEquals(ReceiptType.INFLATION, receipts.get(4).getType());
    Assertions.assertEquals(333, ((InflationReceipt) receipts.get(4)).getAmount().longValue());
}
Also used : BalanceTransferReceipt(io.nem.symbol.sdk.model.receipt.BalanceTransferReceipt) Receipt(io.nem.symbol.sdk.model.receipt.Receipt) ArtifactExpiryReceipt(io.nem.symbol.sdk.model.receipt.ArtifactExpiryReceipt) InflationReceipt(io.nem.symbol.sdk.model.receipt.InflationReceipt) InflationReceipt(io.nem.symbol.sdk.model.receipt.InflationReceipt) TransactionStatementInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.TransactionStatementInfoDTO) ArtifactExpiryReceipt(io.nem.symbol.sdk.model.receipt.ArtifactExpiryReceipt) TransactionStatement(io.nem.symbol.sdk.model.receipt.TransactionStatement) BalanceTransferReceipt(io.nem.symbol.sdk.model.receipt.BalanceTransferReceipt) Test(org.junit.jupiter.api.Test)

Aggregations

ArtifactExpiryReceipt (io.nem.symbol.sdk.model.receipt.ArtifactExpiryReceipt)2 BalanceTransferReceipt (io.nem.symbol.sdk.model.receipt.BalanceTransferReceipt)2 InflationReceipt (io.nem.symbol.sdk.model.receipt.InflationReceipt)2 Receipt (io.nem.symbol.sdk.model.receipt.Receipt)2 TransactionStatement (io.nem.symbol.sdk.model.receipt.TransactionStatement)2 Test (org.junit.jupiter.api.Test)2 TransactionStatementInfoDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.TransactionStatementInfoDTO)1 TransactionStatementInfoDTO (io.nem.symbol.sdk.openapi.vertx.model.TransactionStatementInfoDTO)1