@Test
public void testAddTransactionsDependingOn() throws Exception {

    CoinSelector originalCoinSelector = wallet.getCoinSelector();
    try {
        wallet.allowSpendingUnconfirmedTransactions();
        sendMoneyToWallet(AbstractBlockChain.NewBlockType.BEST_CHAIN, valueOf(2, 0));
        Transaction send1 = checkNotNull(wallet.createSend(OTHER_ADDRESS, valueOf(1, 0)));
        Transaction send2 = checkNotNull(wallet.createSend(OTHER_ADDRESS, valueOf(1, 20)));
        wallet.commitTx(send1);
        Transaction send1b = checkNotNull(wallet.createSend(OTHER_ADDRESS, valueOf(0, 50)));
        wallet.commitTx(send1b);
        Transaction send1c = checkNotNull(wallet.createSend(OTHER_ADDRESS, valueOf(0, 25)));
        wallet.commitTx(send1c);
        wallet.commitTx(send2);
        Set<Transaction> txns = new HashSet<Transaction>();
        txns.add(send1);
        wallet.addTransactionsDependingOn(txns, wallet.getTransactions(true));
        assertEquals(3, txns.size());
        assertTrue(txns.contains(send1));
        assertTrue(txns.contains(send1b));
        assertTrue(txns.contains(send1c));
    } finally {
        wallet.setCoinSelector(originalCoinSelector);
    }
}