The JUnit setup methodexceptionIOException Description of Exception Project project = new Project(); IndexTask task = new IndexTask(); FileSet fs = new FileSet(); fs.setDir(new File(docsDir)); task.addFileset(fs); task.setOverwrite(true); task.setDocumentHandler(docHandler); task.setIndex(new File(indexDir)); task.setProject(project); task.execute(); searcher = new IndexSearcher(indexDir); analyzer = new StopAnalyzer();
Project project = new Project(); IndexTask task = new IndexTask(); FileSet fs = new FileSet(); fs.setDir(new File(docsDir)); task.addFileset(fs); task.setOverwrite(true); task.setDocumentHandler(docHandler); task.setIndex(new File(indexDir)); task.setProject(project); task.execute(); searcher = new IndexSearcher(indexDir); analyzer = new StopAnalyzer();
The teardown method for JUnittodoremove indexDir? searcher.close();
searcher.close();
Query query = new QueryParser("contents",analyzer).parse("test"); Hits hits = searcher.search(query); assertEquals("Find document(s)", 2, hits.length());