@Test(expected = InsufficientMoneyException.class)
public void dontSpendStubs() throws Exception {

    // Form a pledge and then try to spend it with another pledge. Should reject.
    WalletTestObjects objects = new WalletTestObjects(() -> new PledgingWallet(UnitTestParams.get()));
    PledgingWallet wallet = (PledgingWallet) objects.wallet;
    objects.sendAmounts(1_000_000);
    Project project = new Project(makeProject(wallet, 3_000_000));
    PledgingWallet.PendingPledge pledge = wallet.createPledge(project, 1_000_000, null);
    pledge.commit(true);
    // Check that pledges are serialized.
    wallet = roundtripWallet(wallet);
    // This line should fail because the output we received is already pledged elsewhere.
    wallet.createPledge(project, 800_000, null);
}