### Question:
TransactionLogFileReader { public Transaction getNextTransaction() throws IncompleteTransactionException, CRCValidationException, IOException { long crcValue; byte[] bytes; int len; byte EOF; try { crcValue = ia.readLong("crcvalue"); len = ia.readInt("txtEntry"); } catch (IOException e) { raf.seek(lastTransactionFilePointer); return null; } if (crcValue == 0 && len == 0) { raf.seek(lastTransactionFilePointer); return null; } try { bytes = new byte[len]; raf.readFully(bytes); EOF = ia.readByte("EOF"); } catch (IOException e) { raf.seek(lastTransactionFilePointer); throw new IncompleteTransactionException("Problem with reading file before transaction end", e); } if (EOF == 0) { raf.seek(lastTransactionFilePointer); throw new IncompleteTransactionException("Transaction delimiter byte not set"); } if (EOF != 'B') { raf.seek(lastTransactionFilePointer); throw new CRCValidationException("Transaction delimiter byte wrong"); } Checksum crc = new Adler32(); crc.update(bytes, 0, bytes.length); if (crcValue != crc.getValue()) { raf.seek(lastTransactionFilePointer); throw new CRCValidationException("Transaction CRC validation failed"); } TxnHeader hdr = new TxnHeader(); Record record = deserializeTxn(bytes, hdr); lastTransactionFilePointer = raf.getFilePointer(); return new Transaction(hdr, record); } TransactionLogFileReader(File transactionLogFile); Transaction getNextTransaction(); void reset(); FileHeader getFileHeader(); File getTransactionLogFile();  }### Answer:
@Test public void getNextTransactionTest() { Transaction t; int counter = 0; StringBuilder transactionPrint = new StringBuilder(); TransactionPrinter printer = new TransactionPrinter(transactionPrint,new UnicodeDecoder()); try { TransactionLogFileReader reader = new TransactionLogFileReader(txnLog1); do { t = reader.getNextTransaction(); if (t != null) { printer.print(t); transactionPrint.append(lineSeparator()).append(lineSeparator()); counter++; } } while (t != null); assertEquals(66, counter); logger.debug(transactionPrint); } catch (IOException ex) { fail(); } }