SynonymIndexBuilder { public void deleteAllDocuments() throws IOException { getWriter().deleteAll(); } SynonymIndexBuilder(); Error getError(); void setSynonymSeparator(char synonymSeparator); void initIndexInFS(String path); boolean insertDocument(String word, String synonyms); boolean insertDocumentIfNotExists(String word, String synonyms); int updateDocument(String word, String synonyms); int deleteDocumentByWord(String word); void deleteAllDocuments(); int addSynonymToDocument(String word, String newSynonym); int removeSynonymFromDocument(String word, String synonymToDelete); boolean deleteIndexFromFS(String path); void closeIndex(); void commit(); Analyzer getAnalyzer(); int getNumDocs();  }
@Test public void testDeleteAllDocuments() throws IOException { printLineToConsole("\n---------------Test deleteAllDocuments----------"); SynonymIndexBuilder builder = createNewIndexBuilder(INDEX_PATH); insertDocuments(builder); builder.deleteAllDocuments(); assertEquals(0, builder.getWriter().getDocStats().numDocs); SynonymIndexSearcher searcher = getSearcher(builder); assertEquals("A searcher should still see the documents as no commit has been done yet", false, searcher.getNumDocs() == 0); builder.commit(); assertEquals( "The previous searcher should still see the documents as it still has a reader on the indexs before the commit has been done", false, searcher.getNumDocs() == 0); searcher.close(); searcher = getSearcher(builder); assertEquals("A new searcher should not see the documents anymore as a commit has been done", true, searcher.getNumDocs() == 0); searcher.close(); builder.closeIndex(); }