TXFarSideCMTracker { boolean foundTxInProgress(TXCommitMessage message) { return null != message && message.isProcessing(); } TXFarSideCMTracker(int historySize); int getHistorySize(); boolean commitProcessReceived(Object key); void waitForAllToProcess(); void waitToProcess(TXLockId lockId, DistributionManager dm); TXCommitMessage processed(TXCommitMessage processedMess); void removeMessage(TXCommitMessage deadMess); TXCommitMessage get(Object key); TXCommitMessage waitForMessage(Object key, DistributionManager dm); void add(TXCommitMessage msg); void saveTXForClientFailover(TXId txId, TXCommitMessage msg); TXCommitMessage getTXCommitMessage(TXId txId); void clearForCacheClose(); @VisibleForTesting int getFailoverMapSize();  }
@Test public void findTxInProgressReturnsTrueIfMessageIsProcessing() { when(message.isProcessing()).thenReturn(true); boolean found = tracker.foundTxInProgress(message); assertThat(found).isTrue(); }
@Test public void findTxInProgressReturnsFalseIfMessageIsNotProcessing() { when(message.isProcessing()).thenReturn(false); boolean found = tracker.foundTxInProgress(message); assertThat(found).isFalse(); }
@Test public void findTxInProgressReturnsFalseIfMessageIsNull() { boolean found = tracker.foundTxInProgress(null); assertThat(found).isFalse(); }