### Question:
AccountRepositoryVertxImpl extends AbstractRepositoryVertxImpl implements AccountRepository { @Override public Observable<AccountInfo> getAccountInfo(Address address) { Consumer<Handler<AsyncResult<AccountInfoDTO>>> callback = handler -> getClient().getAccountInfo(address.plain(), handler); return exceptionHandling(call(callback).map(this::toAccountInfo)); } AccountRepositoryVertxImpl(ApiClient apiClient); @Override Observable<AccountInfo> getAccountInfo(Address address); @Override Observable<List<AccountInfo>> getAccountsInfo(List<Address> addresses); @Override Observable<Page<AccountInfo>> search(AccountSearchCriteria criteria);  }### Answer:
@Test public void shouldGetAccountInfo() throws Exception { Address address = Address.generateRandom(this.networkType); AccountDTO accountDTO = new AccountDTO(); accountDTO.setAccountType(AccountTypeEnum.NUMBER_1); accountDTO.setAddress(encodeAddress(address)); List<Mosaic> mosaicDtos = new ArrayList<>(); mosaicDtos.add(new Mosaic().id("0000000000000ABC").amount(BigInteger.TEN)); accountDTO.setMosaics(mosaicDtos); AccountInfoDTO accountInfoDTO = new AccountInfoDTO(); accountInfoDTO.setAccount(accountDTO); mockRemoteCall(accountInfoDTO); AccountInfo resolvedAccountInfo = repository.getAccountInfo(address).toFuture().get(); Assertions.assertEquals(address, resolvedAccountInfo.getAddress()); Assertions.assertEquals(AccountType.MAIN, resolvedAccountInfo.getAccountType()); Assertions.assertEquals(1, resolvedAccountInfo.getMosaics().size()); Assertions.assertEquals( "0000000000000ABC", resolvedAccountInfo.getMosaics().get(0).getId().getIdAsHex()); Assertions.assertEquals(BigInteger.TEN, resolvedAccountInfo.getMosaics().get(0).getAmount()); }
@Test public void shouldProcessExceptionWhenNotFound() { Address address = Address.generateRandom(this.networkType); AccountDTO accountDTO = new AccountDTO(); accountDTO.setAccountType(AccountTypeEnum.NUMBER_1); accountDTO.setAddress(encodeAddress(address)); AccountInfoDTO accountInfoDTO = new AccountInfoDTO(); accountInfoDTO.setAccount(accountDTO); mockErrorCode(404, "Account not found!"); Assertions.assertEquals( "ApiException: Not Found - 404 - Code Not Found - Account not found!", Assertions.assertThrows( RepositoryCallException.class, () -> { ExceptionUtils.propagate( () -> repository.getAccountInfo(address).toFuture().get()); }) .getMessage()); }
@Test public void shouldProcessExceptionWhenNotFoundInvalidResponse() { Address address = Address.generateRandom(this.networkType); AccountDTO accountDTO = new AccountDTO(); accountDTO.setAccountType(AccountTypeEnum.NUMBER_1); accountDTO.setAddress(encodeAddress(address)); AccountInfoDTO accountInfoDTO = new AccountInfoDTO(); accountInfoDTO.setAccount(accountDTO); mockErrorCodeRawResponse(400, "I'm a raw error, not json"); Assertions.assertEquals( "ApiException: Bad Request - 400 - I'm a raw error, not json", Assertions.assertThrows( RepositoryCallException.class, () -> { ExceptionUtils.propagate( () -> repository.getAccountInfo(address).toFuture().get()); }) .getMessage()); }