### Question:
EthereumUtils { public static Pair<EthSendTransaction, GenerateSignatureResponseApdu> sendTransaction( BigInteger gasPrice, BigInteger gasLimit, String from, String to, BigInteger value, IsoDep isoTag, String publicKey, String data, String url, byte chainId, int keyIndex, byte[] pin) throws Exception { Web3j web3 = Web3jFactory.build(new HttpService(url)); RawTransaction rawTransaction = RawTransaction.createTransaction( getNextNonce(web3, from), gasPrice, gasLimit, to, value, data); byte[] encodedTransaction = encode(rawTransaction, chainId); final byte[] hashedTransaction = Hash.sha3(encodedTransaction); final GenerateSignatureResponseApdu signedTransaction = NfcUtils.generateSignature(IsoTagWrapper.of(isoTag), keyIndex, hashedTransaction, pin); Log.d(TAG, String.format("signed transaction: %s", ByteUtils.bytesToHex(signedTransaction.getSignature()))); byte[] r = Bytes.trimLeadingZeroes(extractR(signedTransaction.getSignature())); byte[] s = Bytes.trimLeadingZeroes(extractS(signedTransaction.getSignature())); Log.d(TAG, String.format("r: %s", ByteUtils.bytesToHex(r))); Log.d(TAG, String.format("s: %s", ByteUtils.bytesToHex(s))); s = getCanonicalisedS(r, s); Log.d(TAG, String.format("s canonicalised: %s", ByteUtils.bytesToHex(s))); byte v = getV(publicKey, hashedTransaction, r, s); Log.d(TAG, String.format("v: %s", v)); Sign.SignatureData signatureData = new Sign.SignatureData(v, r, s); signatureData = TransactionEncoder.createEip155SignatureData(signatureData, chainId); String hexValue = Numeric.toHexString(TransactionEncoder.encode(rawTransaction, signatureData)); EthSendTransaction ethSendTransaction = web3.ethSendRawTransaction(hexValue).send(); if (ethSendTransaction != null && ethSendTransaction.getError() != null) { Log.e(TAG, String.format("TransactionError: %s", ethSendTransaction.getError().getMessage())); } return new Pair<>(ethSendTransaction, signedTransaction); }  static EthBalanceBean getBalance(String ethAddress, String url); static Pair<EthSendTransaction, GenerateSignatureResponseApdu> sendTransaction(
            BigInteger gasPrice, BigInteger gasLimit, String from,
            String to, BigInteger value, IsoDep isoTag,
            String publicKey, String data, String url, byte chainId, int keyIndex, byte[] pin); static BigInteger getNextNonce(Web3j web3j, String etherAddress);  }### Answer:
@Test @Ignore public void testSendTransaction() throws Exception { PowerMockito.mockStatic(NfcUtils.class); when(NfcUtils.generateSignature(any(), anyInt(), any(), any())).thenAnswer( (Answer) invocation -> { Object[] args = invocation.getArguments(); return TransactionSigner.signTransaction((byte[]) args[2]); }); final Pair<EthSendTransaction, GenerateSignatureResponseApdu> ethSendTransaction = EthereumUtils.sendTransaction( GAS_PRICE, GAS_LIMIT, TransactionSigner.credentials.getAddress(), "0xa8e5590D3E1377BAfac30d3D3AB5779A62e0FF28", Convert.toWei("0.002", Convert.Unit.ETHER).toBigInteger(), isoDep, Numeric.toHexStringNoPrefixZeroPadded(TransactionSigner.credentials.getEcKeyPair().getPublicKey(), 128), "", ROPSTEN_URI, ChainId.ROPSTEN, 1, null); assertNull(ethSendTransaction.first.getError()); System.out.println(ethSendTransaction.first.getTransactionHash()); assertThat(ethSendTransaction.first.getResult(), containsString("0x")); }