@Test
public void doIfSenderCannotCoverFees() throws Throwable {

    setUpWireMockForCall("invokescript", "invokescript_transfer_with_fixed_sysfee.json");
    setUpWireMockForBalanceOf(account1.getScriptHash(),
            "invokefunction_balanceOf_1000000.json");
    Wallet w = Wallet.withAccounts(account1);
    long netFee = 1247390;
    // The system fee found in the `invokescript_transfer_with_fixed_sysfee.json` file.
    long sysFee = 9007990;
    BigInteger expectedFees = BigInteger.valueOf(netFee + sysFee);
    BigInteger expectedBalance = BigInteger.valueOf(1_000_000L);
    AtomicBoolean tested = new AtomicBoolean(false);
    new GasToken(neow)
            .invokeFunction(NEP5_TRANSFER,
                    ContractParameter.hash160(account1.getScriptHash()),
                    ContractParameter.hash160(recipient),
                    ContractParameter.integer(2_000_000))
            .wallet(w)
            .signers(Signer.feeOnly(w.getDefaultAccount().getScriptHash()))
            .validUntilBlock(2000000)
            .doIfSenderCannotCoverFees((fee, balance) -> {
                assertThat(fee, is(expectedFees));
                assertThat(balance, is(expectedBalance));
                tested.set(true);
            })
            .buildTransaction();
    assertTrue(tested.get()); // Assert that the test actually called the lambda function.
}