### Question:
TransactionLog implements Iterable<Transaction> { @Override public TransactionIterator iterator() { return new TransactionLogIterator(transactionLogList, factory); } TransactionLog(final File transactionLogFile, TransactionLogReaderFactory factory);  TransactionLog(TransactionLogFileList transactionLogFileList, TransactionLogReaderFactory factory); @Override TransactionIterator iterator();  }### Answer:
@Test public void transactionStateTest() throws Exception{ TransactionIterator iterator = transactionLogFile.iterator(); assertTrue(iterator.hasNext()); assertTrue(iterator.nextTransactionState() == TransactionState.OK); assertEquals(1,iterator.next().getTxnHeader().getZxid()); while(iterator.next().getTxnHeader().getZxid()!=15){ assertTrue(iterator.hasNext()); assertTrue(iterator.nextTransactionState() == TransactionState.OK); } while(!iterator.hasNext()){} assertTrue(iterator.hasNext()); assertTrue(iterator.nextTransactionState() == TransactionState.OK); assertEquals(16,iterator.next().getTxnHeader().getZxid()); do{ iterator.next(); } while(iterator.hasNext()); assertFalse(iterator.hasNext()); while(!iterator.hasNext()){} assertEquals(21,iterator.next().getTxnHeader().getZxid()); assertTrue(iterator.nextTransactionState()==TransactionState.INCOMPLETE); assertTrue(iterator.nextTransactionState()==TransactionState.CORRUPTION); }