Skip to content

Commit

Permalink
bitcoinj 0.15: Fix TransactionAwareTradeTest
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarguindzberg committed May 9, 2019
1 parent 6b45535 commit 04af88a
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import bisq.core.arbitration.DisputeManager;
import bisq.core.trade.Trade;

import org.bitcoinj.core.Sha256Hash;
import org.bitcoinj.core.Transaction;

import javafx.collections.FXCollections;
Expand All @@ -45,7 +46,9 @@
@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"})
@SuppressWarnings("ConstantConditions")
public class TransactionAwareTradeTest {
private static final String XID = "123";
private static final Sha256Hash XID = Sha256Hash.wrap("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef");



private Transaction transaction;
private DisputeManager manager;
Expand All @@ -55,7 +58,7 @@ public class TransactionAwareTradeTest {
@Before
public void setUp() {
this.transaction = mock(Transaction.class);
when(transaction.getTxId().toString()).thenReturn(XID);
when(transaction.getTxId()).thenReturn(XID);

this.delegate = mock(Trade.class, RETURNS_DEEP_STUBS);
this.manager = mock(DisputeManager.class, RETURNS_DEEP_STUBS);
Expand All @@ -64,25 +67,25 @@ public void setUp() {

@Test
public void testIsRelatedToTransactionWhenTakerOfferFeeTx() {
when(delegate.getTakerFeeTxId()).thenReturn(XID);
when(delegate.getTakerFeeTxId()).thenReturn(XID.toString());
assertTrue(trade.isRelatedToTransaction(transaction));
}

@Test
public void testIsRelatedToTransactionWhenPayoutTx() {
when(delegate.getPayoutTx().getTxId().toString()).thenReturn(XID);
when(delegate.getPayoutTx().getTxId()).thenReturn(XID);
assertTrue(trade.isRelatedToTransaction(transaction));
}

@Test
public void testIsRelatedToTransactionWhenDepositTx() {
when(delegate.getDepositTx().getTxId().toString()).thenReturn(XID);
when(delegate.getDepositTx().getTxId()).thenReturn(XID);
assertTrue(trade.isRelatedToTransaction(transaction));
}

@Test
public void testIsRelatedToTransactionWhenOfferFeeTx() {
when(delegate.getOffer().getOfferFeePaymentTxId()).thenReturn(XID);
when(delegate.getOffer().getOfferFeePaymentTxId()).thenReturn(XID.toString());
assertTrue(trade.isRelatedToTransaction(transaction));
}

Expand All @@ -91,7 +94,7 @@ public void testIsRelatedToTransactionWhenDisputedPayoutTx() {
final String tradeId = "7";

Dispute dispute = mock(Dispute.class);
when(dispute.getDisputePayoutTxId()).thenReturn(XID);
when(dispute.getDisputePayoutTxId()).thenReturn(XID.toString());
when(dispute.getTradeId()).thenReturn(tradeId);

when(manager.getDisputesAsObservableList())
Expand Down

0 comments on commit 04af88a

Please sign in to comment.