use of io.nem.symbol.sdk.api.CurrencyService in project nem2-sdk-java by nemtech.
the class CurrencyServiceIntegrationTest method getNetworkCurrencies.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getNetworkCurrencies(RepositoryType type) {
RepositoryFactory repositoryFactory = getRepositoryFactory(type);
CurrencyService service = new CurrencyServiceImpl(repositoryFactory);
NetworkCurrencies networkCurrencies = get(service.getNetworkCurrencies());
Assertions.assertNotNull(networkCurrencies.getCurrency());
Assertions.assertEquals(networkCurrencies.getCurrency().getUnresolvedMosaicId(), networkCurrencies.getCurrency().getMosaicId().get());
Assertions.assertNotNull(networkCurrencies.getCurrency().getMosaicId().get());
Assertions.assertEquals(networkCurrencies.getCurrency(), (get(repositoryFactory.getNetworkCurrency())));
Assertions.assertNotNull(networkCurrencies.getHarvest());
Assertions.assertEquals(networkCurrencies.getHarvest().getUnresolvedMosaicId(), networkCurrencies.getHarvest().getMosaicId().get());
Assertions.assertNotNull(networkCurrencies.getHarvest().getMosaicId().get());
Assertions.assertEquals(networkCurrencies.getHarvest(), (get(repositoryFactory.getHarvestCurrency())));
}
use of io.nem.symbol.sdk.api.CurrencyService in project nem2-sdk-java by nemtech.
the class CurrencyServiceIntegrationTest method testNetworkCurrencyInvalidNamespaceId.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void testNetworkCurrencyInvalidNamespaceId(RepositoryType type) {
RepositoryFactory repositoryFactory = getRepositoryFactory(type);
CurrencyService service = new CurrencyServiceImpl(repositoryFactory);
RepositoryCallException exception = Assertions.assertThrows(RepositoryCallException.class, () -> {
get(service.getCurrencyFromNamespaceId(NamespaceId.createFromName("invalid.currency")));
});
Assertions.assertEquals("ApiException: Not Found - 404 - ResourceNotFound - no resource exists with id 'C1DF8A076D934A50'", exception.getMessage());
}
use of io.nem.symbol.sdk.api.CurrencyService in project nem2-sdk-java by nemtech.
the class CurrencyServiceIntegrationTest method testNetworkCurrencyInvaliMosaicId.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void testNetworkCurrencyInvaliMosaicId(RepositoryType type) {
RepositoryFactory repositoryFactory = getRepositoryFactory(type);
CurrencyService service = new CurrencyServiceImpl(repositoryFactory);
RepositoryCallException exception = Assertions.assertThrows(RepositoryCallException.class, () -> {
get(service.getCurrency(new MosaicId(BigInteger.TEN)));
});
Assertions.assertEquals("ApiException: Not Found - 404 - ResourceNotFound - no resource exists with id '000000000000000A'", exception.getMessage());
}
Aggregations