use of io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO in project nem2-sdk-java by nemtech.
the class TransactionRepositoryVertxImplTest method shouldGetTransactionsConfirmed.
@Test
public void shouldGetTransactionsConfirmed() throws Exception {
TransactionInfoDTO transactionInfoDTO = TestHelperVertx.loadTransactionInfoDTO("aggregateMosaicCreationTransaction.json", TransactionInfoDTO.class);
String hash = jsonHelper.getString(transactionInfoDTO, "meta", "hash");
mockRemoteCall(Collections.singletonList(transactionInfoDTO));
Transaction transaction = repository.getTransactions(TransactionGroup.CONFIRMED, Collections.singletonList(hash)).toFuture().get().get(0);
Assertions.assertNotNull(transaction);
Assertions.assertEquals(hash, transaction.getTransactionInfo().get().getHash().get());
Assertions.assertEquals(TransactionGroup.CONFIRMED, transaction.getGroup().get());
}
use of io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO in project nem2-sdk-java by nemtech.
the class TransactionRepositoryVertxImplTest method shouldGetTransactionConfirmed.
@Test
public void shouldGetTransactionConfirmed() throws Exception {
TransactionInfoDTO transactionInfoDTO = TestHelperVertx.loadTransactionInfoDTO("aggregateMosaicCreationTransaction.json", TransactionInfoDTO.class);
String hash = jsonHelper.getString(transactionInfoDTO, "meta", "hash");
mockRemoteCall(transactionInfoDTO);
Transaction transaction = repository.getTransaction(TransactionGroup.CONFIRMED, hash).toFuture().get();
Assertions.assertNotNull(transaction);
Assertions.assertEquals(hash, transaction.getTransactionInfo().get().getHash().get());
Assertions.assertEquals(TransactionGroup.CONFIRMED, transaction.getGroup().get());
}
use of io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO in project nem2-sdk-java by nemtech.
the class TransactionRepositoryVertxImplTest method exceptionWhenRestCallFails.
@Test
public void exceptionWhenRestCallFails() {
TransactionInfoDTO transactionInfoDTO = new TransactionInfoDTO();
TransactionMetaDTO meta = new TransactionMetaDTO();
meta.setHash("ABC");
transactionInfoDTO.setMeta(meta);
mockErrorCode(400, "The error message");
RepositoryCallException exception = Assertions.assertThrows(RepositoryCallException.class, () -> {
ExceptionUtils.propagateVoid(() -> {
repository.getTransaction(TransactionGroup.CONFIRMED, meta.getHash()).toFuture().get();
});
});
Assertions.assertTrue(exception.getMessage().contains("The error message"));
}
use of io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO in project nem2-sdk-java by nemtech.
the class TransactionRepositoryVertxImplTest method shouldGetTransactionPartial.
@Test
public void shouldGetTransactionPartial() throws Exception {
TransactionInfoDTO transactionInfoDTO = TestHelperVertx.loadTransactionInfoDTO("aggregateMosaicCreationTransaction.json", TransactionInfoDTO.class);
String hash = jsonHelper.getString(transactionInfoDTO, "meta", "hash");
mockRemoteCall(transactionInfoDTO);
Transaction transaction = repository.getTransaction(TransactionGroup.PARTIAL, hash).toFuture().get();
Assertions.assertNotNull(transaction);
Assertions.assertEquals(hash, transaction.getTransactionInfo().get().getHash().get());
Assertions.assertEquals(TransactionGroup.PARTIAL, transaction.getGroup().get());
}
use of io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO in project nem2-sdk-java by nemtech.
the class TransactionRepositoryVertxImplTest method exceptionWhenMapperFails.
@Test
public void exceptionWhenMapperFails() {
TransactionInfoDTO transactionInfoDTO = new TransactionInfoDTO();
TransactionMetaDTO meta = new TransactionMetaDTO();
String hash = "ABC";
meta.setHash(hash);
transactionInfoDTO.setMeta(meta);
mockRemoteCall(transactionInfoDTO);
RepositoryCallException exception = Assertions.assertThrows(RepositoryCallException.class, () -> {
ExceptionUtils.propagateVoid(() -> {
repository.getTransaction(TransactionGroup.CONFIRMED, hash).toFuture().get();
});
});
Assertions.assertTrue(exception.getMessage().contains("Transaction cannot be mapped, object does not not have transaction type."));
}
Aggregations