source: class TransactionBuilderTest {
  
      private static final ScriptHash NEO_TOKEN_SCRIPT_HASH;
      private static final String NEP5_TRANSFER;
      private static final String SCRIPT_NEO_INVOKEFUNCTION_NAME;
      private Account account1;
      private Account account2;
      private Account multiSigAcc;
      private ScriptHash recipient;
      @Rule
      public WireMockRule wireMockRule;
      @Rule
      public ExpectedException exceptionRule;
      private Neow3j neow;
  
      @Test
      public void throwIfSenderCannotCoverFees() throws Throwable {
  
target:         setUpWireMockForCall("invokescript", "invokescript_transfer_with_fixed_sysfee.json");
          setUpWireMockForCall("invokefunction", "invokefunction_balanceOf_1000000.json",
                  "668e0c1f9d7b70a99dd9e06eadd4c784d641afbc",
                  "balanceOf",
                  "721e1376b75fe93889023d47832c160fcc5d4a06");
  
          Wallet w = Wallet.withAccounts(account1);
  
          TransactionBuilder b = new NeoToken(neow)
                  .invokeFunction(NEP5_TRANSFER,
                          ContractParameter.hash160(account1.getScriptHash()),
                          ContractParameter.hash160(recipient),
                          ContractParameter.integer(5))
                  .wallet(w)
                  .validUntilBlock(2000000)
                  .signers(Signer.calledByEntry(account1.getScriptHash()))
                  .throwIfSenderCannotCoverFees(
                          () -> new IllegalStateException("test throwIfSenderCannotCoverFees"));
  
          exceptionRule.expect(IllegalStateException.class);
          exceptionRule.expectMessage("test throwIfSenderCannotCoverFees");
          b.buildTransaction();
      }
  
  }