use of io.nem.symbol.sdk.api.RepositoryCallException in project nem2-sdk-java by nemtech.
the class MosaicRepositoryIntegrationTest method throwExceptionWhenMosaicDoesNotExists.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void throwExceptionWhenMosaicDoesNotExists(RepositoryType type) {
RepositoryCallException exception = Assertions.assertThrows(RepositoryCallException.class, () -> get(getMosaicRepository(type).getMosaic(new MosaicId("AAAAAE18BE375DA2"))));
Assertions.assertEquals("ApiException: Not Found - 404 - ResourceNotFound - no resource exists with id 'AAAAAE18BE375DA2'", exception.getMessage());
}
use of io.nem.symbol.sdk.api.RepositoryCallException in project nem2-sdk-java by nemtech.
the class HashLockRepositoryIntegrationTest method getHashLockWhenDoesNotExist.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getHashLockWhenDoesNotExist(RepositoryType type) {
HashLockRepository HashLockRepository = getRepositoryFactory(type).createHashLockRepository();
String hash = "671653C94E2254F2A23EFEDB15D67C38332AED1FBD24B063C0A8E675582B6A96";
RepositoryCallException exception = Assertions.assertThrows(RepositoryCallException.class, () -> get(HashLockRepository.getHashLock(hash)));
Assertions.assertTrue(exception.getMessage().contains("ApiException: Not Found - 404 - ResourceNotFound - no resource exists with id"));
}
use of io.nem.symbol.sdk.api.RepositoryCallException in project nem2-sdk-java by nemtech.
the class HashLockRepositoryIntegrationTest method getHashLockWhenInvalid.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getHashLockWhenInvalid(RepositoryType type) {
HashLockRepository HashLockRepository = getRepositoryFactory(type).createHashLockRepository();
String hash = "invalid!";
RepositoryCallException exception = Assertions.assertThrows(RepositoryCallException.class, () -> get(HashLockRepository.getHashLock(hash)));
Assertions.assertEquals("ApiException: Conflict - 409 - InvalidArgument - hash has an invalid format", exception.getMessage());
}
use of io.nem.symbol.sdk.api.RepositoryCallException 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 io.nem.symbol.sdk.api.RepositoryCallException 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());
}
Aggregations