LuceneService { public List<Document> search(Query query, boolean prefixWildCard) { List<Document> documents = new ArrayList<Document>(); try { IndexSearcher searcher = getSearcher(); TopDocs search = searcher.search(query, 10000); for (ScoreDoc scoreDoc : search.scoreDocs) { Document doc = searcher.doc(scoreDoc.doc); documents.add(doc); } } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } return documents; } LuceneService();   LuceneService(Directory directory); void indexDocument(Document doc); void indexDocuments(List<Document> docs); void removeDocument(Query query); void removeDocuments(List<Query> queries); List<Document> search(Query query, boolean prefixWildCard); void clearIndex();  }
@Test public void testSearch_1() throws Exception { LuceneService fixture = new LuceneService(); Query query = new BooleanQuery.Builder().build(); boolean prefixWildCard = true; List<Document> result = fixture.search(query, prefixWildCard); assertNotNull(result); }
@Test public void testSearch_2() throws Exception { LuceneService fixture = new LuceneService(); Query query = new BooleanQuery.Builder().build(); boolean prefixWildCard = true; List<Document> result = fixture.search(query, prefixWildCard); assertNotNull(result); }