### Question:
TransactionMonitor { public void startAtFirstTransaction() { if (!running) { iterator = transactionLog.iterator(); running = true; monitorThread.start(); } } TransactionMonitor(final TransactionLog transactionLog); void startAtFirstTransaction(); void startAtLastTransaction(); void stop(); void addListener(TransactionListener l); void removeListener(TransactionListener l);  }### Answer:
@Test(timeout = 3000) public void testStartAtFirstTransaction() throws InterruptedException { when(transactionIterator.nextTransactionState()) .thenReturn(TransactionState.OK) .thenReturn(TransactionState.OK) .thenReturn(TransactionState.OK) .thenReturn(TransactionState.OK) .thenReturn(TransactionState.EMPTY) .thenReturn(TransactionState.INCOMPLETE) .thenReturn(TransactionState.OK) .thenReturn(TransactionState.OK) .thenReturn(TransactionState.OK) .thenReturn(TransactionState.EMPTY); final CountDownLatch endSignal = new CountDownLatch(7); transactionMonitor.addListener(new TransactionListener() { int nextTransaction = 1; @Override public void onTransaction(Transaction t) { assertEquals(nextTransaction, t.getTxnHeader().getZxid()); nextTransaction++; endSignal.countDown(); logger.debug("test 1:" + nextTransaction); } @Override public void onPartialTransaction() { logger.debug("Incomplete"); assertEquals(5, nextTransaction); } @Override public void onCorruption() { fail(); } }); transactionMonitor.startAtFirstTransaction(); endSignal.await(); }