### Question:
Web3jService implements BlockchainService { @Override public String getClientVersion() { try { final Web3ClientVersion web3ClientVersion = web3j.web3ClientVersion().send(); return web3ClientVersion.getWeb3ClientVersion(); } catch (IOException e) { throw new BlockchainException("Error when obtaining client version", e); } } Web3jService(String nodeName,
                        Web3j web3j,
                        ContractEventDetailsFactory eventDetailsFactory,
                        AsyncTaskService asyncTaskService); @Override List<ContractEventDetails> retrieveEvents(ContractEventFilter eventFilter,
                                                     BigInteger startBlock,
                                                     BigInteger endBlock); @Override FilterSubscription registerEventListener(ContractEventFilter eventFilter,
                                                    ContractEventListener eventListener,
                                                    BigInteger startBlock,
                                                    BigInteger endBlock,
                                                    Optional<Runnable> onCompletion); @Override String getClientVersion(); @Override TransactionReceipt getTransactionReceipt(String txId); @Override BigInteger getCurrentBlockNumber(); Optional<Block> getBlock(String blockHash, boolean fullTransactionObjects); List<ContractEventDetails> getEventsForFilter(ContractEventFilter filter, BigInteger blockNumber); @Override String getRevertReason(String from, String to, BigInteger blockNumber, String input);  }### Answer:
@Test public void testGetClientVersionHappyPath() throws IOException { final Request<?, Web3ClientVersion> mockRequest = mock(Request.class); final Web3ClientVersion mockClientVersion = mock(Web3ClientVersion.class); when(mockClientVersion.getWeb3ClientVersion()).thenReturn("Version 1.0"); when(mockRequest.send()).thenReturn(mockClientVersion); doReturn(mockRequest).when(mockWeb3j).web3ClientVersion(); assertEquals("Version 1.0", underTest.getClientVersion()); }
@Test(expected = BlockchainException.class) public void testGetClientVersionIOException() throws IOException { final Request<?, Web3ClientVersion> mockRequest = mock(Request.class); when(mockRequest.send()).thenThrow(new IOException()); doReturn(mockRequest).when(mockWeb3j).web3ClientVersion(); underTest.getClientVersion(); }