protected TransactionReceipt executeTransaction(Function function)
            throws IOException, TransactionException {
        return executeTransaction(function, BigInteger.ZERO);
    }
@Test
    public void testJsonRpcError() throws IOException {
        EthSendTransaction ethSendTransaction = new EthSendTransaction();
        Response.Error error = new Response.Error(1, "Invalid Transaction");
        error.setData("Additional data");
        ethSendTransaction.setError(error);

        TransactionManager txManager =
                spy(new RawTransactionManager(web3j, SampleKeys.CREDENTIALS));
        doReturn(ethSendTransaction)
                .when(txManager)
                .sendTransaction(
                        any(BigInteger.class),
                        any(BigInteger.class),
                        anyString(),
                        anyString(),
                        any(BigInteger.class),
                        anyBoolean());

        JsonRpcError exception =
                assertThrows(
                        JsonRpcError.class,
                        () ->
                                txManager.executeTransaction(
                                        BigInteger.ZERO,
                                        BigInteger.ZERO,
                                        "",
                                        "",
                                        BigInteger.ZERO,
                                        false));

        assertEquals(error.getCode(), exception.getCode());
        assertEquals(error.getMessage(), exception.getMessage());
        assertEquals(error.getData(), exception.getData());
    }