Search in sources :

Example 1 with TransactionStatusDTO

use of io.nem.symbol.sdk.openapi.okhttp_gson.model.TransactionStatusDTO in project nem2-sdk-java by nemtech.

the class TransactionStatusRepositoryOkHttpImplTest method shouldGetTransactionStatus.

@Test
public void shouldGetTransactionStatus() throws Exception {
    TransactionStatusDTO transactionStatusDTO = new TransactionStatusDTO();
    transactionStatusDTO.setGroup(TransactionGroupEnum.FAILED);
    transactionStatusDTO.setDeadline(BigInteger.valueOf(5));
    transactionStatusDTO.setHeight(BigInteger.valueOf(6));
    transactionStatusDTO.setCode(TransactionStatusEnum.FAILURE_ACCOUNTLINK_LINK_ALREADY_EXISTS);
    transactionStatusDTO.setHash("someHash");
    mockRemoteCall(transactionStatusDTO);
    TransactionStatus transaction = repository.getTransactionStatus(transactionStatusDTO.getHash()).toFuture().get();
    Assertions.assertNotNull(transaction);
    Assertions.assertEquals(transactionStatusDTO.getHash(), transaction.getHash());
    Assertions.assertEquals(5L, transaction.getDeadline().getValue());
    Assertions.assertEquals(BigInteger.valueOf(6L), transaction.getHeight());
    Assertions.assertEquals("Failure_AccountLink_Link_Already_Exists", transaction.getCode());
    Assertions.assertEquals(transaction.getGroup().getValue(), transactionStatusDTO.getGroup().getValue());
}
Also used : TransactionStatusDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.TransactionStatusDTO) TransactionStatus(io.nem.symbol.sdk.model.transaction.TransactionStatus) Test(org.junit.jupiter.api.Test)

Example 2 with TransactionStatusDTO

use of io.nem.symbol.sdk.openapi.okhttp_gson.model.TransactionStatusDTO in project nem2-sdk-java by nemtech.

the class TransactionStatusRepositoryOkHttpImplTest method shouldGetTransactionStatuses.

@Test
public void shouldGetTransactionStatuses() throws Exception {
    TransactionStatusDTO transactionStatusDTO = new TransactionStatusDTO();
    transactionStatusDTO.setGroup(TransactionGroupEnum.FAILED);
    transactionStatusDTO.setDeadline(BigInteger.valueOf(5));
    transactionStatusDTO.setHeight(BigInteger.valueOf(6));
    transactionStatusDTO.setCode(TransactionStatusEnum.FAILURE_ACCOUNTLINK_LINK_ALREADY_EXISTS);
    transactionStatusDTO.setHash("someHash");
    mockRemoteCall(Collections.singletonList(transactionStatusDTO));
    TransactionStatus transaction = repository.getTransactionStatuses(Collections.singletonList(transactionStatusDTO.getHash())).toFuture().get().get(0);
    Assertions.assertNotNull(transaction);
    Assertions.assertEquals(transactionStatusDTO.getHash(), transaction.getHash());
    Assertions.assertEquals(5L, transaction.getDeadline().getValue());
    Assertions.assertEquals(BigInteger.valueOf(6L), transaction.getHeight());
    Assertions.assertEquals("Failure_AccountLink_Link_Already_Exists", transaction.getCode());
    Assertions.assertEquals(transaction.getGroup().getValue(), transactionStatusDTO.getGroup().getValue());
}
Also used : TransactionStatusDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.TransactionStatusDTO) TransactionStatus(io.nem.symbol.sdk.model.transaction.TransactionStatus) Test(org.junit.jupiter.api.Test)

Aggregations

TransactionStatus (io.nem.symbol.sdk.model.transaction.TransactionStatus)2 TransactionStatusDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.TransactionStatusDTO)2 Test (org.junit.jupiter.api.Test)2