use of org.junit.jupiter.params.provider.EnumSource in project nem2-sdk-java by nemtech.
the class AccountRepositoryIntegrationTest method getAccountInfoNotExisting.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getAccountInfoNotExisting(RepositoryType type) {
AccountRepository accountHttp = getRepositoryFactory(type).createAccountRepository();
Address addressObject = Address.createFromPublicKey("67F69FA4BFCD158F6E1AF1ABC82F725F5C5C4710D6E29217B12BE66397435DFB", getNetworkType());
RepositoryCallException exception = Assertions.assertThrows(RepositoryCallException.class, () -> get(accountHttp.getAccountInfo(addressObject)));
Assertions.assertTrue(exception.getMessage().contains("ApiException: Not Found - 404 - ResourceNotFound - no resource exists with id"));
}
use of org.junit.jupiter.params.provider.EnumSource in project nem2-sdk-java by nemtech.
the class AccountRepositoryIntegrationTest method getMultipleTransactions.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getMultipleTransactions(RepositoryType type) {
TransactionRepository transactionRepository = getRepositoryFactory(type).createTransactionRepository();
Account account = config().getDefaultAccount();
List<TransactionType> transactionTypes = Arrays.asList(TransactionType.TRANSFER, TransactionType.AGGREGATE_COMPLETE, TransactionType.NAMESPACE_METADATA);
List<Transaction> transactions = get(transactionRepository.search(new TransactionSearchCriteria(TransactionGroup.CONFIRMED).signerPublicKey(account.getPublicAccount().getPublicKey()).transactionTypes(transactionTypes))).getData();
Assertions.assertFalse(transactions.isEmpty());
transactions.forEach(t -> Assertions.assertTrue(transactionTypes.contains(t.getType())));
}
use of org.junit.jupiter.params.provider.EnumSource in project nem2-sdk-java by nemtech.
the class AccountSearchRepositoryIntegrationTest method searchMosaicIdProvided.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void searchMosaicIdProvided(RepositoryType type) {
AccountPaginationStreamer streamer = new AccountPaginationStreamer(this.getAccountRepository(type));
RepositoryFactory repositoryFactory = getRepositoryFactory(type);
NamespaceId networkCurrencyId = get(repositoryFactory.getNetworkCurrency()).getNamespaceId().get();
Assertions.assertTrue(networkCurrencyId.getFullName().isPresent());
MosaicId mosaicId = get(repositoryFactory.createNamespaceRepository().getLinkedMosaicId(networkCurrencyId));
AccountSearchCriteria criteria = new AccountSearchCriteria().mosaicId(mosaicId);
List<AccountInfo> accounts = get(streamer.search(criteria).toList().toObservable());
Assertions.assertFalse(accounts.isEmpty());
System.out.println(toJson(accounts));
accounts.forEach(a -> {
Assertions.assertTrue(a.getMosaics().stream().filter(m -> m.getId().equals(mosaicId)).findFirst().get().getAmount().longValue() > 0);
});
}
use of org.junit.jupiter.params.provider.EnumSource in project nem2-sdk-java by nemtech.
the class AccountSearchRepositoryIntegrationTest method searchNoMosaicIdProvided.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void searchNoMosaicIdProvided(RepositoryType type) {
RepositoryCallException exception = Assertions.assertThrows(RepositoryCallException.class, () -> get(this.getAccountRepository(type).search(new AccountSearchCriteria().orderBy(AccountOrderBy.BALANCE))));
Assertions.assertEquals("ApiException: Conflict - 409 - InvalidArgument - mosaicId must be provided when sorting by balance", exception.getMessage());
}
use of org.junit.jupiter.params.provider.EnumSource in project nem2-sdk-java by nemtech.
the class AggregateTransactionServiceIntegrationTest method isTransferFromMultisigNotComplete.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void isTransferFromMultisigNotComplete(RepositoryType type) {
Account multisigAccount = helper().getMultisigAccount(type).getLeft();
TransferTransaction transferTransaction = TransferTransactionFactory.create(getNetworkType(), getDeadline(), getRecipient(), Collections.emptyList()).message(new PlainMessage("")).maxFee(maxFee).build();
AggregateTransaction aggregateTransaction = AggregateTransactionFactory.createComplete(getNetworkType(), getDeadline(), Collections.singletonList(transferTransaction.toAggregate(multisigAccount.getPublicAccount()))).maxFee(maxFee).build();
SignedTransaction signedAggregateTransaction = aggregateTransaction.signTransactionWithCosigners(multisigAccount, Collections.singletonList(config().getTestAccount()), getGenerationHash());
AggregateTransactionService aggregateTransactionService = new AggregateTransactionServiceImpl(getRepositoryFactory(type));
Assertions.assertFalse(get(aggregateTransactionService.isComplete(signedAggregateTransaction)));
}
Aggregations