@Test
public void selectable() throws Exception {

    Transaction t;
    t = new Transaction(params);
    t.getConfidence().setConfidenceType(TransactionConfidence.ConfidenceType.PENDING);
    assertFalse(DefaultCoinSelector.isSelectable(t));
    t.getConfidence().setSource(TransactionConfidence.Source.SELF);
    assertFalse(DefaultCoinSelector.isSelectable(t));
    t.getConfidence().markBroadcastBy(new PeerAddress(InetAddress.getByName("1.2.3.4")));
    assertFalse(DefaultCoinSelector.isSelectable(t));
    t.getConfidence().markBroadcastBy(new PeerAddress(InetAddress.getByName("5.6.7.8")));
    assertTrue(DefaultCoinSelector.isSelectable(t));
    t = new Transaction(params);
    t.getConfidence().setConfidenceType(TransactionConfidence.ConfidenceType.BUILDING);
    assertTrue(DefaultCoinSelector.isSelectable(t));
    t = new Transaction(RegTestParams.get());
    t.getConfidence().setConfidenceType(TransactionConfidence.ConfidenceType.PENDING);
    t.getConfidence().setSource(TransactionConfidence.Source.SELF);
    assertTrue(DefaultCoinSelector.isSelectable(t));
}