### Question:
TransactionAwareTrade implements TransactionAwareTradable { @Override public boolean isRelatedToTransaction(Transaction transaction) { String txId = transaction.getTxId().toString(); boolean isTakerOfferFeeTx = txId.equals(trade.getTakerFeeTxId()); boolean isOfferFeeTx = isOfferFeeTx(txId); boolean isDepositTx = isDepositTx(txId); boolean isPayoutTx = isPayoutTx(txId); boolean isDisputedPayoutTx = isDisputedPayoutTx(txId); boolean isDelayedPayoutTx = isDelayedPayoutTx(txId); boolean isRefundPayoutTx = isRefundPayoutTx(txId); return isTakerOfferFeeTx || isOfferFeeTx || isDepositTx || isPayoutTx || isDisputedPayoutTx || isDelayedPayoutTx || isRefundPayoutTx; } TransactionAwareTrade(Trade trade,
                          ArbitrationManager arbitrationManager,
                          RefundManager refundManager,
                          BtcWalletService btcWalletService,
                          PubKeyRing pubKeyRing); @Override boolean isRelatedToTransaction(Transaction transaction); @Override Tradable asTradable();  }### Answer:
@Test public void testIsRelatedToTransactionWhenTakerOfferFeeTx() { when(delegate.getTakerFeeTxId()).thenReturn(XID.toString()); assertTrue(trade.isRelatedToTransaction(transaction)); }
@Test public void testIsRelatedToTransactionWhenPayoutTx() { when(delegate.getPayoutTx().getTxId()).thenReturn(XID); assertTrue(trade.isRelatedToTransaction(transaction)); }
@Test public void testIsRelatedToTransactionWhenDepositTx() { when(delegate.getDepositTx().getTxId()).thenReturn(XID); assertTrue(trade.isRelatedToTransaction(transaction)); }
@Test public void testIsRelatedToTransactionWhenOfferFeeTx() { when(delegate.getOffer().getOfferFeePaymentTxId()).thenReturn(XID.toString()); assertTrue(trade.isRelatedToTransaction(transaction)); }
@Test public void testIsRelatedToTransactionWhenDisputedPayoutTx() { final String tradeId = "7"; Dispute dispute = mock(Dispute.class); when(dispute.getDisputePayoutTxId()).thenReturn(XID.toString()); when(dispute.getTradeId()).thenReturn(tradeId); when(arbitrationManager.getDisputesAsObservableList()) .thenReturn(FXCollections.observableArrayList(Collections.singleton(dispute))); when(delegate.getId()).thenReturn(tradeId); assertTrue(trade.isRelatedToTransaction(transaction)); }