### Question:
TransactionRecorder { public void replay(IndexWriter writer) throws IOException { if (fileSystem.exists(walPath)) { FSDataInputStream inputStream = fileSystem.open(walPath); replay(writer, inputStream); inputStream.close(); commit(writer); } else { open(); } }  void init(); void open(); void replay(IndexWriter writer); void close(); long replaceRow(boolean wal, Row row, TrackingIndexWriter writer); long deleteRow(boolean wal, String rowId, TrackingIndexWriter writer); void setWalPath(Path walPath); void setConfiguration(Configuration configuration); void commit(IndexWriter writer); static List<Document> getDocs(Row row, BlurAnalyzer analyzer); static Document convert(String rowId, Record record, StringBuilder builder, BlurAnalyzer analyzer); void setAnalyzer(BlurAnalyzer analyzer);  }### Answer:
@Test public void testReplay() throws IOException { String tmpPath = "./tmp/transaction-recorder/wal"; rm(new File(tmpPath)); KeywordAnalyzer analyzer = new KeywordAnalyzer(); Configuration configuration = new Configuration(); BlurAnalyzer blurAnalyzer = new BlurAnalyzer(analyzer); TransactionRecorder transactionRecorder = new TransactionRecorder(); transactionRecorder.setAnalyzer(blurAnalyzer); transactionRecorder.setConfiguration(configuration); transactionRecorder.setWalPath(new Path(tmpPath)); transactionRecorder.init(); transactionRecorder.open(); try { transactionRecorder.replaceRow(true, genRow(), null); fail("Should NPE"); } catch (NullPointerException e) { } transactionRecorder.close(); RAMDirectory directory = new RAMDirectory(); IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_35, analyzer); IndexWriter writer = new IndexWriter(directory, conf); TransactionRecorder replayTransactionRecorder = new TransactionRecorder(); replayTransactionRecorder.setAnalyzer(blurAnalyzer); replayTransactionRecorder.setConfiguration(configuration); replayTransactionRecorder.setWalPath(new Path(tmpPath)); replayTransactionRecorder.init(); replayTransactionRecorder.replay(writer); IndexReader reader = IndexReader.open(directory); assertEquals(1, reader.numDocs()); }