From 04af88ae9dd77813b5d85e039553355b64ece9ed Mon Sep 17 00:00:00 2001 From: Oscar Guindzberg Date: Thu, 9 May 2019 17:12:38 -0300 Subject: [PATCH] bitcoinj 0.15: Fix TransactionAwareTradeTest --- .../transactions/TransactionAwareTradeTest.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/desktop/src/test/java/bisq/desktop/main/funds/transactions/TransactionAwareTradeTest.java b/desktop/src/test/java/bisq/desktop/main/funds/transactions/TransactionAwareTradeTest.java index 271dbfe0ac0..17364d43df2 100644 --- a/desktop/src/test/java/bisq/desktop/main/funds/transactions/TransactionAwareTradeTest.java +++ b/desktop/src/test/java/bisq/desktop/main/funds/transactions/TransactionAwareTradeTest.java @@ -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; @@ -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; @@ -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); @@ -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)); } @@ -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())