closing Analyzers in tearDown
@@ -29,6 +29,7 @@ import org.apache.lucene.analysis.path.PathHierarchyTokenizer;
import org.apache.lucene.analysis.pattern.PatternCaptureGroupTokenFilter;
import org.apache.lucene.analysis.pattern.PatternReplaceFilter;
import org.apache.lucene.analysis.reverse.ReverseStringFilter;
+import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -54,7 +55,7 @@ public class DefaultAnalyzersConfigurationTest {
private Analyzer allChildrenPathSearchingAnalyzer;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
this.exactPathAnalyzer = new Analyzer() {
@Override
protected TokenStreamComponents createComponents(String fieldName) {
@@ -118,6 +119,17 @@ public class DefaultAnalyzersConfigurationTest {
};
}
+ @After
+ public void tearDown() {
+ this.exactPathAnalyzer.close();
+ this.parentPathIndexingAnalyzer.close();
+ this.parentPathSearchingAnalyzer.close();
+ this.directChildrenPathIndexingAnalyzer.close();
+ this.directChildrenPathSearchingAnalyzer.close();
+ this.allChildrenPathIndexingAnalyzer.close();
+ this.allChildrenPathSearchingAnalyzer.close();
+ }
+
@Test
public void testAllChildrenIndexingTokenization() throws Exception {
try {
