Apache Lucene open-source search software
LUCENE-2642: merge LuceneTestCase and LuceneTestCaseJ4
Robert Muirfeabadea20e0
diff --git a/lucene/contrib/ant/src/test/org/apache/lucene/ant/DocumentTestCase.java b/lucene/contrib/ant/src/test/org/apache/lucene/ant/DocumentTestCase.javaindex 2ef623b8a15..e0c11eee695 100644--- a/lucene/contrib/ant/src/test/org/apache/lucene/ant/DocumentTestCase.java+++ b/lucene/contrib/ant/src/test/org/apache/lucene/ant/DocumentTestCase.java@@ -25,10 +25,6 @@ import org.apache.lucene.util.LuceneTestCase;public abstract class DocumentTestCase extends LuceneTestCase{- public DocumentTestCase(String name) {- super(name);- }-protected File getFile(String filename) throws IOException {String fullname =this.getClass().getResource(filename).getFile();diff --git a/lucene/contrib/ant/src/test/org/apache/lucene/ant/HtmlDocumentTest.java b/lucene/contrib/ant/src/test/org/apache/lucene/ant/HtmlDocumentTest.javaindex 80eeea8fd1c..c622cf38f6a 100644--- a/lucene/contrib/ant/src/test/org/apache/lucene/ant/HtmlDocumentTest.java+++ b/lucene/contrib/ant/src/test/org/apache/lucene/ant/HtmlDocumentTest.java@@ -24,10 +24,6 @@ import org.apache.lucene.ant.HtmlDocument;public class HtmlDocumentTest extends DocumentTestCase{- public HtmlDocumentTest (String name) {- super(name);- }-HtmlDocument doc;@Overridediff --git a/lucene/contrib/ant/src/test/org/apache/lucene/ant/IndexTaskTest.java b/lucene/contrib/ant/src/test/org/apache/lucene/ant/IndexTaskTest.javaindex e22177c9eb0..c91cd96739b 100644--- a/lucene/contrib/ant/src/test/org/apache/lucene/ant/IndexTaskTest.java+++ b/lucene/contrib/ant/src/test/org/apache/lucene/ant/IndexTaskTest.java@@ -50,7 +50,7 @@ public class IndexTaskTest extends LuceneTestCase {*@exception IOException Description of Exception*/@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();// slightly hackish way to get the src/test dirString docsDir = getDataFile("test.txt").getParent();@@ -87,7 +87,7 @@ public class IndexTaskTest extends LuceneTestCase {* TODO: remove indexDir?*/@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher.close();dir.close();super.tearDown();diff --git a/lucene/contrib/ant/src/test/org/apache/lucene/ant/TextDocumentTest.java b/lucene/contrib/ant/src/test/org/apache/lucene/ant/TextDocumentTest.javaindex 0d099dd3bed..5a44c68b42b 100644--- a/lucene/contrib/ant/src/test/org/apache/lucene/ant/TextDocumentTest.java+++ b/lucene/contrib/ant/src/test/org/apache/lucene/ant/TextDocumentTest.java@@ -24,10 +24,6 @@ import org.apache.lucene.ant.TextDocument;public class TextDocumentTest extends DocumentTestCase{- public TextDocumentTest (String name) {- super(name);- }-TextDocument doc;@Overridediff --git a/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java b/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.javaindex 022dad3fd83..21a739f7f0e 100755--- a/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java+++ b/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java@@ -60,7 +60,7 @@ import org.apache.lucene.search.FieldCache;public class TestPerfTasksLogic extends BenchmarkTestCase {@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();copyToWorkDir("reuters.first20.lines.txt");}diff --git a/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksParse.java b/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksParse.javaindex ff514693558..bc4bc9045dc 100755--- a/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksParse.java+++ b/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksParse.java@@ -37,10 +37,6 @@ public class TestPerfTasksParse extends LuceneTestCase {INDENT + "print.props=false" + NEW_LINE;- public TestPerfTasksParse(String name) {- super(name);- }-/** Test the repetiotion parsing for parallel tasks */public void testParseParallelTaskSequenceRepetition() throws Exception {String taskStr = "AddDoc";diff --git a/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/utils/TestConfig.java b/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/utils/TestConfig.javaindex 469f4325773..939f74d990a 100644--- a/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/utils/TestConfig.java+++ b/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/utils/TestConfig.java@@ -17,14 +17,12 @@ package org.apache.lucene.benchmark.byTask.utils;* limitations under the License.*/-import static org.junit.Assert.*;-import java.util.Properties;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.junit.Test;-public class TestConfig extends LuceneTestCaseJ4 {+public class TestConfig extends LuceneTestCase {@Testpublic void testAbsolutePathNamesWindows() throws Exception {diff --git a/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/quality/TestQualityRun.java b/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/quality/TestQualityRun.javaindex c5188528b3b..70c7757999d 100644--- a/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/quality/TestQualityRun.java+++ b/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/quality/TestQualityRun.java@@ -46,7 +46,7 @@ import org.apache.lucene.store.FSDirectory;public class TestQualityRun extends BenchmarkTestCase {@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();copyToWorkDir("reuters.578.lines.txt.bz2");}diff --git a/lucene/contrib/db/bdb-je/src/test/org/apache/lucene/store/je/JEStoreTest.java b/lucene/contrib/db/bdb-je/src/test/org/apache/lucene/store/je/JEStoreTest.javaindex 9079cefda6c..827c5e34411 100644--- a/lucene/contrib/db/bdb-je/src/test/org/apache/lucene/store/je/JEStoreTest.java+++ b/lucene/contrib/db/bdb-je/src/test/org/apache/lucene/store/je/JEStoreTest.java@@ -53,7 +53,7 @@ public class JEStoreTest extends LuceneTestCase {protected Database index, blocks;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();if (!dbHome.exists())@@ -100,7 +100,7 @@ public class JEStoreTest extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {if (index != null)index.close();diff --git a/lucene/contrib/db/bdb/src/test/org/apache/lucene/store/db/DbStoreTest.java b/lucene/contrib/db/bdb/src/test/org/apache/lucene/store/db/DbStoreTest.javaindex f766bd516e9..4ca79ef95ee 100644--- a/lucene/contrib/db/bdb/src/test/org/apache/lucene/store/db/DbStoreTest.java+++ b/lucene/contrib/db/bdb/src/test/org/apache/lucene/store/db/DbStoreTest.java@@ -48,7 +48,7 @@ public class DbStoreTest extends LuceneTestCase {protected Database index, blocks;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();if (!dbHome.exists())dbHome.mkdir();@@ -100,7 +100,7 @@ public class DbStoreTest extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {if (index != null)index.close();if (blocks != null)diff --git a/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java b/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.javaindex b9bacec7198..61beab80994 100644--- a/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java+++ b/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java@@ -106,15 +106,6 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte"This text has a typo in referring to Keneddy","wordx wordy wordz wordx wordy wordx worda wordb wordy wordc", "y z x y z a b", "lets is a the lets is a the lets is a the lets" };- /**- * Constructor for HighlightExtractorTest.- *- * @param arg0- */- public HighlighterTest(String arg0) {- super(arg0);- }-public void testQueryScorerHits() throws Exception {Analyzer analyzer = new MockAnalyzer(MockTokenizer.SIMPLE, true);QueryParser qp = new QueryParser(TEST_VERSION_CURRENT, FIELD_NAME, analyzer);@@ -1719,7 +1710,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte}@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();dir = newDirectory();ramDir = newDirectory();@@ -1755,7 +1746,7 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {if (searcher != null) searcher.close();reader.close();dir.close();diff --git a/lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/AbstractTestCase.java b/lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/AbstractTestCase.javaindex b57125b77a4..0e66e232fc3 100644--- a/lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/AbstractTestCase.java+++ b/lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/AbstractTestCase.java@@ -85,7 +85,7 @@ public abstract class AbstractTestCase extends LuceneTestCase {};@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();analyzerW = new MockAnalyzer(MockTokenizer.WHITESPACE, false);analyzerB = new BigramAnalyzer();@@ -96,7 +96,7 @@ public abstract class AbstractTestCase extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {if( reader != null ){reader.close();reader = null;diff --git a/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java b/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.javaindex 4481c418455..25be87bd000 100644--- a/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java+++ b/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java@@ -36,11 +36,6 @@ import org.apache.lucene.util.LuceneTestCase;* Tests changing of field norms with a custom similarity and with fake norms.*/public class TestFieldNormModifier extends LuceneTestCase {-- public TestFieldNormModifier(String name) {- super(name);- }-public static int NUM_DOCS = 5;public Directory store;@@ -54,7 +49,7 @@ public class TestFieldNormModifier extends LuceneTestCase {};@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();store = newDirectory();IndexWriter writer = new IndexWriter(store, newIndexWriterConfig(@@ -76,7 +71,7 @@ public class TestFieldNormModifier extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {store.close();super.tearDown();}diff --git a/lucene/contrib/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java b/lucene/contrib/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.javaindex 86b03aa05dc..f861063942d 100644--- a/lucene/contrib/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java+++ b/lucene/contrib/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java@@ -29,7 +29,7 @@ public class TestMultiPassIndexSplitter extends LuceneTestCase {Directory dir;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();dir = newDirectory();IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));@@ -50,7 +50,7 @@ public class TestMultiPassIndexSplitter extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {input.close();dir.close();super.tearDown();diff --git a/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java b/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.javaindex d483cf28be5..fa781cf9a95 100644--- a/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java+++ b/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java@@ -39,11 +39,6 @@ import org.apache.lucene.util.LuceneTestCase;* Tests changing the norms after changing the simularity*/public class TestLengthNormModifier extends LuceneTestCase {-- public TestLengthNormModifier(String name) {- super(name);- }-public static int NUM_DOCS = 5;public Directory store;@@ -57,7 +52,7 @@ public class TestLengthNormModifier extends LuceneTestCase {};@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();store = newDirectory();IndexWriter writer = new IndexWriter(store, newIndexWriterConfig(@@ -82,7 +77,7 @@ public class TestLengthNormModifier extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {store.close();super.tearDown();}diff --git a/lucene/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java b/lucene/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.javaindex b0444fda8aa..92acd683031 100644--- a/lucene/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java+++ b/lucene/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java@@ -36,7 +36,7 @@ public class BooleanFilterTest extends LuceneTestCase {private IndexReader reader;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = newDirectory();RandomIndexWriter writer = new RandomIndexWriter(random, directory, new MockAnalyzer(MockTokenizer.WHITESPACE, false));@@ -53,7 +53,7 @@ public class BooleanFilterTest extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {mainReader.close();directory.close();super.tearDown();diff --git a/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java b/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.javaindex dbfabb13fa8..f5f7eb4b052 100644--- a/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java+++ b/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java@@ -53,7 +53,7 @@ public class ChainedFilterTest extends LuceneTestCase {private QueryWrapperFilter sueFilter;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = newDirectory();RandomIndexWriter writer = new RandomIndexWriter(random, directory);diff --git a/lucene/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java b/lucene/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.javaindex cde625d237d..a040d303fb8 100644--- a/lucene/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java+++ b/lucene/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java@@ -39,7 +39,7 @@ public class DuplicateFilterTest extends LuceneTestCase {private IndexSearcher searcher;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = newDirectory();RandomIndexWriter writer = new RandomIndexWriter(random, directory);@@ -65,7 +65,7 @@ public class DuplicateFilterTest extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {reader.close();searcher.close();directory.close();diff --git a/lucene/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java b/lucene/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.javaindex 37532cc155f..5f2bec5b04c 100644--- a/lucene/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java+++ b/lucene/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java@@ -37,7 +37,7 @@ public class FuzzyLikeThisQueryTest extends LuceneTestCase {private Analyzer analyzer=new MockAnalyzer();@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = newDirectory();RandomIndexWriter writer = new RandomIndexWriter(random, directory);@@ -55,7 +55,7 @@ public class FuzzyLikeThisQueryTest extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher.close();reader.close();directory.close();diff --git a/lucene/contrib/queries/src/test/org/apache/lucene/search/regex/TestRegexQuery.java b/lucene/contrib/queries/src/test/org/apache/lucene/search/regex/TestRegexQuery.javaindex ca4058aa063..0b03d38d369 100644--- a/lucene/contrib/queries/src/test/org/apache/lucene/search/regex/TestRegexQuery.java+++ b/lucene/contrib/queries/src/test/org/apache/lucene/search/regex/TestRegexQuery.java@@ -38,7 +38,7 @@ public class TestRegexQuery extends LuceneTestCase {@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = newDirectory();RandomIndexWriter writer = new RandomIndexWriter(random, directory);@@ -51,7 +51,7 @@ public class TestRegexQuery extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher.close();reader.close();directory.close();diff --git a/lucene/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java b/lucene/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.javaindex 5efc85cae01..09a45246be3 100644--- a/lucene/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java+++ b/lucene/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java@@ -42,7 +42,7 @@ public class TestMoreLikeThis extends LuceneTestCase {private IndexSearcher searcher;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = newDirectory();RandomIndexWriter writer = new RandomIndexWriter(random, directory);@@ -57,7 +57,7 @@ public class TestMoreLikeThis extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {reader.close();searcher.close();directory.close();diff --git a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/analyzing/TestAnalyzingQueryParser.java b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/analyzing/TestAnalyzingQueryParser.javaindex da858846231..6e0143ae5b8 100644--- a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/analyzing/TestAnalyzingQueryParser.java+++ b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/analyzing/TestAnalyzingQueryParser.java@@ -45,7 +45,7 @@ public class TestAnalyzingQueryParser extends LuceneTestCase {private String[] fuzzyExpected;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();wildcardInput = new String[] { "übersetzung über*ung","Mötley Cr\u00fce Mötl?* Crü?", "Renée Zellweger Ren?? Zellw?ger" };diff --git a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/complexPhrase/TestComplexPhraseQuery.java b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/complexPhrase/TestComplexPhraseQuery.javaindex b2bc9db52ec..f163a4cece5 100644--- a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/complexPhrase/TestComplexPhraseQuery.java+++ b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/complexPhrase/TestComplexPhraseQuery.java@@ -109,7 +109,7 @@ public class TestComplexPhraseQuery extends LuceneTestCase {}@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();rd = newDirectory();IndexWriter w = new IndexWriter(rd, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer));@@ -126,7 +126,7 @@ public class TestComplexPhraseQuery extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher.close();rd.close();super.tearDown();diff --git a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/ext/TestExtendableQueryParser.java b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/ext/TestExtendableQueryParser.javaindex 7bf794e4e70..c60a0eb6895 100644--- a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/ext/TestExtendableQueryParser.java+++ b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/ext/TestExtendableQueryParser.java@@ -35,10 +35,6 @@ public class TestExtendableQueryParser extends TestQueryParser {private static char[] DELIMITERS = new char[] {Extensions.DEFAULT_EXTENSION_FIELD_DELIMITER, '-', '|' };- public TestExtendableQueryParser(String name) {- super(name);- }-@Overridepublic QueryParser getParser(Analyzer a) throws Exception {return getParser(a, null);diff --git a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/ext/TestExtensions.java b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/ext/TestExtensions.javaindex 8c061b6ae65..3e73cb4576f 100644--- a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/ext/TestExtensions.java+++ b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/ext/TestExtensions.java@@ -27,7 +27,7 @@ public class TestExtensions extends LuceneTestCase {private Extensions ext;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();this.ext = new Extensions();}diff --git a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.java b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.javaindex 2d3b3beff75..ab4c472e76d 100644--- a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.java+++ b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.java@@ -28,7 +28,6 @@ import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;import org.apache.lucene.document.DateTools;import org.apache.lucene.index.Term;-import org.apache.lucene.queryParser.QueryParser;import org.apache.lucene.search.BooleanClause;import org.apache.lucene.search.BooleanQuery;import org.apache.lucene.search.FuzzyQuery;@@ -41,26 +40,19 @@ import org.apache.lucene.search.TermRangeQuery;import org.apache.lucene.search.TermQuery;import org.apache.lucene.search.WildcardQuery;import org.apache.lucene.search.BooleanClause.Occur;-import org.apache.lucene.util.LocalizedTestCase;+import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util.automaton.BasicAutomata;import org.apache.lucene.util.automaton.CharacterRunAutomaton;+import org.junit.runner.RunWith;import java.io.IOException;import java.io.Reader;import java.text.DateFormat;-import java.util.Arrays;import java.util.Calendar;import java.util.GregorianCalendar;-import java.util.HashSet;--public class TestPrecedenceQueryParser extends LocalizedTestCase {-- public TestPrecedenceQueryParser(String name) {- super(name, new HashSet<String>(Arrays.asList(new String[]{- "testDateRange", "testNumber"- })));- }+@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)+public class TestPrecedenceQueryParser extends LuceneTestCase {public static Analyzer qpAnalyzer = new QPTestAnalyzer();public static final class QPTestFilter extends TokenFilter {@@ -129,7 +121,7 @@ public class TestPrecedenceQueryParser extends LocalizedTestCase {private int originalMaxClauses;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();originalMaxClauses = BooleanQuery.getMaxClauseCount();}@@ -726,7 +718,7 @@ public class TestPrecedenceQueryParser extends LocalizedTestCase {@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {BooleanQuery.setMaxClauseCount(originalMaxClauses);super.tearDown();}diff --git a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/spans/TestSpanQueryParser.java b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/spans/TestSpanQueryParser.javaindex 7fb2d2ba735..528f02fd778 100644--- a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/spans/TestSpanQueryParser.java+++ b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/spans/TestSpanQueryParser.java@@ -106,7 +106,7 @@ public class TestSpanQueryParser extends LuceneTestCase {}@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();this.spanProcessorPipeline = new QueryNodeProcessorPipeline();diff --git a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/spans/TestSpanQueryParserSimpleSample.java b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/spans/TestSpanQueryParserSimpleSample.javaindex d71aa74915c..2f467a00b8c 100644--- a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/spans/TestSpanQueryParserSimpleSample.java+++ b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/spans/TestSpanQueryParserSimpleSample.java@@ -95,14 +95,6 @@ import org.apache.lucene.util.LuceneTestCase;*/public class TestSpanQueryParserSimpleSample extends LuceneTestCase {- public TestSpanQueryParserSimpleSample() {- // empty constructor- }-- public TestSpanQueryParserSimpleSample(String testName) {- super(testName);- }-public void testBasicDemo() throws Exception {SyntaxParser queryParser = new StandardSyntaxParser();diff --git a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.javaindex 7f48ec9de85..f153d978ab6 100644--- a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java+++ b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java@@ -25,8 +25,6 @@ import java.util.Calendar;import java.util.Date;import java.util.GregorianCalendar;import java.util.HashMap;-import java.util.HashSet;-import java.util.Arrays;import java.util.List;import java.util.Locale;import java.util.Map;@@ -74,10 +72,11 @@ import org.apache.lucene.search.TermRangeQuery;import org.apache.lucene.search.WildcardQuery;import org.apache.lucene.search.BooleanClause.Occur;import org.apache.lucene.store.Directory;-import org.apache.lucene.util.LocalizedTestCase;+import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util.automaton.BasicAutomata;import org.apache.lucene.util.automaton.CharacterRunAutomaton;import org.apache.lucene.util.automaton.RegExp;+import org.junit.runner.RunWith;/*** This test case is a copy of the core Lucene query parser test, it was adapted@@ -85,15 +84,8 @@ import org.apache.lucene.util.automaton.RegExp;** Tests QueryParser.*/-public class TestQPHelper extends LocalizedTestCase {-- public TestQPHelper(String name) {- super(name, new HashSet<String>(Arrays.asList(new String[]{- "testLegacyDateRange", "testDateRange",- "testCJK", "testNumber", "testFarsiRangeCollating",- "testLocalDateFormat"- })));- }+@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)+public class TestQPHelper extends LuceneTestCase {public static Analyzer qpAnalyzer = new QPTestAnalyzer();@@ -194,7 +186,7 @@ public class TestQPHelper extends LocalizedTestCase {private int originalMaxClauses;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();originalMaxClauses = BooleanQuery.getMaxClauseCount();}@@ -1262,7 +1254,7 @@ public class TestQPHelper extends LocalizedTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {BooleanQuery.setMaxClauseCount(originalMaxClauses);super.tearDown();}diff --git a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQueryParserWrapper.java b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQueryParserWrapper.javaindex ff8e921d2f7..3aa6b899c3d 100644--- a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQueryParserWrapper.java+++ b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQueryParserWrapper.java@@ -68,10 +68,11 @@ import org.apache.lucene.search.TermQuery;import org.apache.lucene.search.TermRangeQuery;import org.apache.lucene.search.WildcardQuery;import org.apache.lucene.store.Directory;-import org.apache.lucene.util.LocalizedTestCase;+import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util.automaton.BasicAutomata;import org.apache.lucene.util.automaton.CharacterRunAutomaton;import org.apache.lucene.util.automaton.RegExp;+import org.junit.runner.RunWith;/*** This test case is a copy of the core Lucene query parser test, it was adapted@@ -82,15 +83,8 @@ import org.apache.lucene.util.automaton.RegExp;* @deprecated this entire test case tests QueryParserWrapper which is* deprecated. When QPW is gone, so will the test.*/-public class TestQueryParserWrapper extends LocalizedTestCase {-- public TestQueryParserWrapper(String name) {- super(name, new HashSet<String>(Arrays.asList(new String[]{- "testLegacyDateRange", "testDateRange",- "testCJK", "testNumber", "testFarsiRangeCollating",- "testLocalDateFormat"- })));- }+@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)+public class TestQueryParserWrapper extends LuceneTestCase {public static Analyzer qpAnalyzer = new QPTestAnalyzer();@@ -209,7 +203,7 @@ public class TestQueryParserWrapper extends LocalizedTestCase {private int originalMaxClauses;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();originalMaxClauses = BooleanQuery.getMaxClauseCount();}@@ -1213,7 +1207,7 @@ public class TestQueryParserWrapper extends LocalizedTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {BooleanQuery.setMaxClauseCount(originalMaxClauses);super.tearDown();}diff --git a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/surround/query/BooleanQueryTst.java b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/surround/query/BooleanQueryTst.javaindex 1396f5c6c80..631b7d88235 100644--- a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/surround/query/BooleanQueryTst.java+++ b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/surround/query/BooleanQueryTst.java@@ -28,15 +28,14 @@ import org.apache.lucene.search.Query;import org.apache.lucene.queryParser.surround.parser.QueryParser;-import junit.framework.TestCase;-import junit.framework.Assert;+import org.junit.Assert;public class BooleanQueryTst {String queryText;final int[] expectedDocNrs;SingleFieldTestDb dBase;String fieldName;- TestCase testCase;+ Assert testCase;BasicQueryFactory qf;boolean verbose = true;@@ -45,7 +44,7 @@ public class BooleanQueryTst {int[] expectedDocNrs,SingleFieldTestDb dBase,String fieldName,- TestCase testCase,+ Assert testCase,BasicQueryFactory qf) {this.queryText = queryText;this.expectedDocNrs = expectedDocNrs;diff --git a/lucene/contrib/remote/src/test/org/apache/lucene/search/RemoteTestCaseJ4.java b/lucene/contrib/remote/src/test/org/apache/lucene/search/RemoteTestCase.javasimilarity index 96%rename from lucene/contrib/remote/src/test/org/apache/lucene/search/RemoteTestCaseJ4.javarename to lucene/contrib/remote/src/test/org/apache/lucene/search/RemoteTestCase.javaindex 1209866e845..351bf7c7a41 100644--- a/lucene/contrib/remote/src/test/org/apache/lucene/search/RemoteTestCaseJ4.java+++ b/lucene/contrib/remote/src/test/org/apache/lucene/search/RemoteTestCase.java@@ -28,7 +28,7 @@ import java.rmi.registry.LocateRegistry;import java.rmi.server.RMIClientSocketFactory;import java.rmi.server.RMIServerSocketFactory;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.junit.AfterClass;/**@@ -38,7 +38,7 @@ import org.junit.AfterClass;* to start the server.* Call {@link #lookupRemote} to get a RemoteSearchable.*/-public abstract class RemoteTestCaseJ4 extends LuceneTestCaseJ4 {+public abstract class RemoteTestCase extends LuceneTestCase {private static int port;public static void startServer(Searchable searchable) throws Exception {diff --git a/lucene/contrib/remote/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java b/lucene/contrib/remote/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.javaindex 5ad94c0f454..29a52b99e2b 100644--- a/lucene/contrib/remote/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java+++ b/lucene/contrib/remote/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java@@ -34,7 +34,7 @@ import static org.junit.Assert.*;/*** Tests that the index is cached on the searcher side of things.*/-public class TestRemoteCachingWrapperFilter extends RemoteTestCaseJ4 {+public class TestRemoteCachingWrapperFilter extends RemoteTestCase {private static Directory indexStore;private static Searchable local;diff --git a/lucene/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSearchable.java b/lucene/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSearchable.javaindex 00beb6086de..b8c577aea1f 100644--- a/lucene/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSearchable.java+++ b/lucene/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSearchable.java@@ -33,7 +33,7 @@ import java.util.Random;import java.util.Set;import java.util.HashSet;-public class TestRemoteSearchable extends RemoteTestCaseJ4 {+public class TestRemoteSearchable extends RemoteTestCase {private static Directory indexStore;private static Searchable local;diff --git a/lucene/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSort.java b/lucene/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSort.javaindex c6b457dc766..1798a55d94d 100644--- a/lucene/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSort.java+++ b/lucene/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSort.java@@ -45,7 +45,7 @@ import org.junit.Test;* methods and therefore unused members and methodes.*/-public class TestRemoteSort extends RemoteTestCaseJ4 {+public class TestRemoteSort extends RemoteTestCase {private static IndexSearcher full;private static Directory indexStore;diff --git a/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java b/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.javaindex e6b4581f0b9..ff88c4f48e3 100644--- a/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java+++ b/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java@@ -67,7 +67,7 @@ public class TestCartesian extends LuceneTestCase {@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = newDirectory();@@ -80,7 +80,7 @@ public class TestCartesian extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {directory.close();super.tearDown();}diff --git a/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java b/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.javaindex 7b2f5fa1639..0ea5f8f533f 100644--- a/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java+++ b/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java@@ -41,7 +41,7 @@ public class TestDistance extends LuceneTestCase {private IndexWriter writer;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = newDirectory();writer = new IndexWriter(directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()));@@ -50,7 +50,7 @@ public class TestDistance extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {writer.close();directory.close();super.tearDown();diff --git a/lucene/contrib/spellchecker/src/test/org/apache/lucene/search/spell/TestLuceneDictionary.java b/lucene/contrib/spellchecker/src/test/org/apache/lucene/search/spell/TestLuceneDictionary.javaindex a8d06c436e2..943b6d6daf0 100644--- a/lucene/contrib/spellchecker/src/test/org/apache/lucene/search/spell/TestLuceneDictionary.java+++ b/lucene/contrib/spellchecker/src/test/org/apache/lucene/search/spell/TestLuceneDictionary.java@@ -43,7 +43,7 @@ public class TestLuceneDictionary extends LuceneTestCase {private Iterator<String> it;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();store = newDirectory();IndexWriter writer = new IndexWriter(store, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));@@ -75,7 +75,7 @@ public class TestLuceneDictionary extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {if (indexReader != null)indexReader.close();store.close();diff --git a/lucene/contrib/spellchecker/src/test/org/apache/lucene/search/spell/TestSpellChecker.java b/lucene/contrib/spellchecker/src/test/org/apache/lucene/search/spell/TestSpellChecker.javaindex d7cb5861c4e..ad753068edc 100755--- a/lucene/contrib/spellchecker/src/test/org/apache/lucene/search/spell/TestSpellChecker.java+++ b/lucene/contrib/spellchecker/src/test/org/apache/lucene/search/spell/TestSpellChecker.java@@ -48,7 +48,7 @@ public class TestSpellChecker extends LuceneTestCase {private List<IndexSearcher> searchers;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();//create a user index@@ -71,7 +71,7 @@ public class TestSpellChecker extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {userindex.close();if (!spellChecker.isClosed())spellChecker.close();diff --git a/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestBasicList.java b/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestBasicList.javaindex 61f3307cef8..5aee55b9439 100644--- a/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestBasicList.java+++ b/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestBasicList.java@@ -31,7 +31,7 @@ public class TestBasicList extends LuceneTestCase {private List<RestaurantInfo> list;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();list = new ArrayList<RestaurantInfo>();list.add(DataStore.canolis);diff --git a/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestBasicTable.java b/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestBasicTable.javaindex d889095b20c..6b6f49c3a48 100644--- a/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestBasicTable.java+++ b/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestBasicTable.java@@ -30,7 +30,7 @@ public class TestBasicTable extends LuceneTestCase {private List<RestaurantInfo> list;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();list = new ArrayList<RestaurantInfo>();list.add(DataStore.canolis);diff --git a/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestSearchingList.java b/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestSearchingList.javaindex 30890dd2202..55566fe768d 100644--- a/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestSearchingList.java+++ b/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestSearchingList.java@@ -27,7 +27,7 @@ public class TestSearchingList extends LuceneTestCase {private ListSearcher listSearcher;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();baseListModel = new BaseListModel(DataStore.getRestaurants());listSearcher = new ListSearcher(baseListModel);diff --git a/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestSearchingTable.java b/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestSearchingTable.javaindex e16ca7ce24b..3715ced8017 100644--- a/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestSearchingTable.java+++ b/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestSearchingTable.java@@ -25,7 +25,7 @@ public class TestSearchingTable extends LuceneTestCase {private TableSearcher tableSearcher;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();baseTableModel = new BaseTableModel(DataStore.getRestaurants());tableSearcher = new TableSearcher(baseTableModel);diff --git a/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestUpdatingList.java b/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestUpdatingList.javaindex a86cc5689d7..f51cec31b2a 100644--- a/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestUpdatingList.java+++ b/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestUpdatingList.java@@ -26,7 +26,7 @@ public class TestUpdatingList extends LuceneTestCase {RestaurantInfo infoToAdd1, infoToAdd2;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();baseListModel = new BaseListModel(DataStore.getRestaurants());listSearcher = new ListSearcher(baseListModel);diff --git a/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestUpdatingTable.java b/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestUpdatingTable.javaindex a0fec80709a..2165bb8f7ea 100644--- a/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestUpdatingTable.java+++ b/lucene/contrib/swing/src/test/org/apache/lucene/swing/models/TestUpdatingTable.java@@ -26,7 +26,7 @@ public class TestUpdatingTable extends LuceneTestCase {RestaurantInfo infoToAdd1, infoToAdd2;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();baseTableModel = new BaseTableModel(DataStore.getRestaurants());tableSearcher = new TableSearcher(baseTableModel);diff --git a/lucene/contrib/wordnet/src/test/org/apache/lucene/wordnet/TestWordnet.java b/lucene/contrib/wordnet/src/test/org/apache/lucene/wordnet/TestWordnet.javaindex f82e7562911..537b69e0dee 100644--- a/lucene/contrib/wordnet/src/test/org/apache/lucene/wordnet/TestWordnet.java+++ b/lucene/contrib/wordnet/src/test/org/apache/lucene/wordnet/TestWordnet.java@@ -38,7 +38,7 @@ public class TestWordnet extends LuceneTestCase {new File(TEMP_DIR,"testLuceneWordnet").getAbsolutePath();@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();// create a temporary synonym indexFile testFile = getDataFile("testSynonyms.txt");@@ -70,7 +70,7 @@ public class TestWordnet extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher.close();rmDir(storePathName); // delete our temporary synonym indexsuper.tearDown();diff --git a/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java b/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.javaindex f44a8e3b88f..a463aeb5047 100644--- a/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java+++ b/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java@@ -50,7 +50,7 @@ public class TestParser extends LuceneTestCase {* @see TestCase#setUp()*/@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();//initialize the parser@@ -85,7 +85,7 @@ public class TestParser extends LuceneTestCase {@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {reader.close();searcher.close();dir.close();diff --git a/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestQueryTemplateManager.java b/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestQueryTemplateManager.javaindex d0256149190..0e4f4b96a12 100644--- a/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestQueryTemplateManager.java+++ b/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestQueryTemplateManager.java@@ -136,7 +136,7 @@ public class TestQueryTemplateManager extends LuceneTestCase {* @see TestCase#setUp()*/@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();@@ -158,7 +158,7 @@ public class TestQueryTemplateManager extends LuceneTestCase {@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher.close();dir.close();super.tearDown();diff --git a/lucene/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java b/lucene/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.javaindex f6a06e7f695..aac035114f8 100644--- a/lucene/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java+++ b/lucene/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java@@ -29,15 +29,6 @@ import org.apache.lucene.util.LuceneTestCase;* Base class for all Lucene unit tests that use TokenStreams.*/public abstract class BaseTokenStreamTestCase extends LuceneTestCase {-- public BaseTokenStreamTestCase() {- super();- }-- public BaseTokenStreamTestCase(String name) {- super(name);- }-// some helpers to test Analyzers and TokenStreams:public static interface CheckClearAttributesAttribute extends Attribute {diff --git a/lucene/src/test/org/apache/lucene/analysis/TestToken.java b/lucene/src/test/org/apache/lucene/analysis/TestToken.javaindex 958a5b89696..ccd0c20015d 100644--- a/lucene/src/test/org/apache/lucene/analysis/TestToken.java+++ b/lucene/src/test/org/apache/lucene/analysis/TestToken.java@@ -27,10 +27,6 @@ import java.io.StringReader;public class TestToken extends LuceneTestCase {- public TestToken(String name) {- super(name);- }-public void testCtor() throws Exception {Token t = new Token();char[] content = "hello".toCharArray();diff --git a/lucene/src/test/org/apache/lucene/analysis/tokenattributes/TestCharTermAttributeImpl.java b/lucene/src/test/org/apache/lucene/analysis/tokenattributes/TestCharTermAttributeImpl.javaindex 57413e027c2..76ca83125f5 100644--- a/lucene/src/test/org/apache/lucene/analysis/tokenattributes/TestCharTermAttributeImpl.java+++ b/lucene/src/test/org/apache/lucene/analysis/tokenattributes/TestCharTermAttributeImpl.java@@ -26,10 +26,6 @@ import java.util.Random;public class TestCharTermAttributeImpl extends LuceneTestCase {- public TestCharTermAttributeImpl(String name) {- super(name);- }-public void testResize() {CharTermAttributeImpl t = new CharTermAttributeImpl();char[] content = "hello".toCharArray();diff --git a/lucene/src/test/org/apache/lucene/analysis/tokenattributes/TestSimpleAttributeImpls.java b/lucene/src/test/org/apache/lucene/analysis/tokenattributes/TestSimpleAttributeImpls.javaindex 7b15236480f..590c8e8550e 100644--- a/lucene/src/test/org/apache/lucene/analysis/tokenattributes/TestSimpleAttributeImpls.java+++ b/lucene/src/test/org/apache/lucene/analysis/tokenattributes/TestSimpleAttributeImpls.java@@ -24,10 +24,6 @@ import org.apache.lucene.util.AttributeSource.AttributeFactory;@Deprecatedpublic class TestSimpleAttributeImpls extends LuceneTestCase {-- public TestSimpleAttributeImpls(String name) {- super(name);- }public void testFlagsAttribute() throws Exception {FlagsAttributeImpl att = new FlagsAttributeImpl();diff --git a/lucene/src/test/org/apache/lucene/document/TestDateTools.java b/lucene/src/test/org/apache/lucene/document/TestDateTools.javaindex f4bafa1496a..02c090f54f1 100644--- a/lucene/src/test/org/apache/lucene/document/TestDateTools.java+++ b/lucene/src/test/org/apache/lucene/document/TestDateTools.java@@ -8,7 +8,8 @@ import java.util.GregorianCalendar;import java.util.TimeZone;import java.util.Locale;-import org.apache.lucene.util.LocalizedTestCase;+import org.apache.lucene.util.LuceneTestCase;+import org.junit.runner.RunWith;/*** Licensed to the Apache Software Foundation (ASF) under one or more@@ -26,8 +27,8 @@ import org.apache.lucene.util.LocalizedTestCase;* See the License for the specific language governing permissions and* limitations under the License.*/--public class TestDateTools extends LocalizedTestCase {+@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)+public class TestDateTools extends LuceneTestCase {public void testStringToDate() throws ParseException {diff --git a/lucene/src/test/org/apache/lucene/index/DocHelper.java b/lucene/src/test/org/apache/lucene/index/DocHelper.javaindex 7d3551669be..d6095f8a144 100644--- a/lucene/src/test/org/apache/lucene/index/DocHelper.java+++ b/lucene/src/test/org/apache/lucene/index/DocHelper.java@@ -30,7 +30,7 @@ import org.apache.lucene.document.Field;import org.apache.lucene.document.Fieldable;import org.apache.lucene.search.Similarity;import org.apache.lucene.store.Directory;-import static org.apache.lucene.util.LuceneTestCaseJ4.TEST_VERSION_CURRENT;+import static org.apache.lucene.util.LuceneTestCase.TEST_VERSION_CURRENT;class DocHelper {public static final String FIELD_1_TEXT = "field one text";diff --git a/lucene/src/test/org/apache/lucene/index/RandomIndexWriter.java b/lucene/src/test/org/apache/lucene/index/RandomIndexWriter.javaindex 684a5c99dad..e0b7fd65e68 100644--- a/lucene/src/test/org/apache/lucene/index/RandomIndexWriter.java+++ b/lucene/src/test/org/apache/lucene/index/RandomIndexWriter.java@@ -26,7 +26,7 @@ import org.apache.lucene.analysis.MockAnalyzer;import org.apache.lucene.document.Document;import org.apache.lucene.index.codecs.CodecProvider;import org.apache.lucene.store.Directory;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util.Version;import org.apache.lucene.util._TestUtil;@@ -63,17 +63,17 @@ public class RandomIndexWriter implements Closeable {/** create a RandomIndexWriter with a random config: Uses TEST_VERSION_CURRENT and MockAnalyzer */public RandomIndexWriter(Random r, Directory dir) throws IOException {- this(r, dir, LuceneTestCaseJ4.newIndexWriterConfig(r, LuceneTestCaseJ4.TEST_VERSION_CURRENT, new MockAnalyzer()));+ this(r, dir, LuceneTestCase.newIndexWriterConfig(r, LuceneTestCase.TEST_VERSION_CURRENT, new MockAnalyzer()));}/** create a RandomIndexWriter with a random config: Uses TEST_VERSION_CURRENT */public RandomIndexWriter(Random r, Directory dir, Analyzer a) throws IOException {- this(r, dir, LuceneTestCaseJ4.newIndexWriterConfig(r, LuceneTestCaseJ4.TEST_VERSION_CURRENT, a));+ this(r, dir, LuceneTestCase.newIndexWriterConfig(r, LuceneTestCase.TEST_VERSION_CURRENT, a));}/** create a RandomIndexWriter with a random config */public RandomIndexWriter(Random r, Directory dir, Version v, Analyzer a) throws IOException {- this(r, dir, LuceneTestCaseJ4.newIndexWriterConfig(r, v, a));+ this(r, dir, LuceneTestCase.newIndexWriterConfig(r, v, a));}/** create a RandomIndexWriter with the provided config */@@ -81,7 +81,7 @@ public class RandomIndexWriter implements Closeable {this.r = r;w = new MockIndexWriter(r, dir, c);flushAt = _TestUtil.nextInt(r, 10, 1000);- if (LuceneTestCaseJ4.VERBOSE) {+ if (LuceneTestCase.VERBOSE) {System.out.println("RIW config=" + w.getConfig());System.out.println("codec default=" + CodecProvider.getDefaultCodec());}@@ -90,7 +90,7 @@ public class RandomIndexWriter implements Closeable {public void addDocument(Document doc) throws IOException {w.addDocument(doc);if (docCount++ == flushAt) {- if (LuceneTestCaseJ4.VERBOSE) {+ if (LuceneTestCase.VERBOSE) {System.out.println("RIW.addDocument: now doing a commit");}w.commit();@@ -127,12 +127,12 @@ public class RandomIndexWriter implements Closeable {// IndexReader.open so terms are sorted in codepoint// order during searching:if (!w.codecs.getWriter(null).name.equals("PreFlex") && r.nextBoolean()) {- if (LuceneTestCaseJ4.VERBOSE) {+ if (LuceneTestCase.VERBOSE) {System.out.println("RIW.getReader: use NRT reader");}return w.getReader();} else {- if (LuceneTestCaseJ4.VERBOSE) {+ if (LuceneTestCase.VERBOSE) {System.out.println("RIW.getReader: open new reader");}w.commit();diff --git a/lucene/src/test/org/apache/lucene/index/TestCodecs.java b/lucene/src/test/org/apache/lucene/index/TestCodecs.javaindex 383a42f88d4..5f73b6a745c 100644--- a/lucene/src/test/org/apache/lucene/index/TestCodecs.java+++ b/lucene/src/test/org/apache/lucene/index/TestCodecs.java@@ -39,8 +39,9 @@ import org.apache.lucene.search.Query;import org.apache.lucene.search.ScoreDoc;import org.apache.lucene.store.Directory;import org.apache.lucene.util.BytesRef;-import org.apache.lucene.util.MultiCodecTestCase;+import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util.Version;+import org.junit.runner.RunWith;// TODO: test multiple codecs here?@@ -59,8 +60,8 @@ import org.apache.lucene.util.Version;// goes to 1 before next one known to exist// - skipTo(term)// - skipTo(doc)--public class TestCodecs extends MultiCodecTestCase {+@RunWith(LuceneTestCase.MultiCodecTestCaseRunner.class)+public class TestCodecs extends LuceneTestCase {private static String[] fieldNames = new String[] {"one", "two", "three", "four"};private final static int NUM_TEST_ITER = 20 * RANDOM_MULTIPLIER;diff --git a/lucene/src/test/org/apache/lucene/index/TestCompoundFile.java b/lucene/src/test/org/apache/lucene/index/TestCompoundFile.javaindex 6f5e6e22cfb..9e4eba610e2 100644--- a/lucene/src/test/org/apache/lucene/index/TestCompoundFile.java+++ b/lucene/src/test/org/apache/lucene/index/TestCompoundFile.java@@ -55,7 +55,7 @@ public class TestCompoundFile extends LuceneTestCase@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();File file = new File(TEMP_DIR, "testIndex");_TestUtil.rmDir(file);@@ -64,7 +64,7 @@ public class TestCompoundFile extends LuceneTestCase}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {dir.close();_TestUtil.rmDir(new File(TEMP_DIR, "testIndex"));super.tearDown();diff --git a/lucene/src/test/org/apache/lucene/index/TestDirectoryReader.java b/lucene/src/test/org/apache/lucene/index/TestDirectoryReader.javaindex 13610ac7c9a..f31d8a5375f 100644--- a/lucene/src/test/org/apache/lucene/index/TestDirectoryReader.java+++ b/lucene/src/test/org/apache/lucene/index/TestDirectoryReader.java@@ -35,13 +35,9 @@ public class TestDirectoryReader extends LuceneTestCase {private Document doc2;protected SegmentReader [] readers = new SegmentReader[2];protected SegmentInfos sis;-- public TestDirectoryReader(String s) {- super(s);- }@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();dir = newDirectory();doc1 = new Document();@@ -55,7 +51,7 @@ public class TestDirectoryReader extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {if (readers[0] != null) readers[0].close();if (readers[1] != null) readers[1].close();dir.close();diff --git a/lucene/src/test/org/apache/lucene/index/TestDoc.java b/lucene/src/test/org/apache/lucene/index/TestDoc.javaindex d1b1101d70c..e09f88fa2eb 100644--- a/lucene/src/test/org/apache/lucene/index/TestDoc.java+++ b/lucene/src/test/org/apache/lucene/index/TestDoc.java@@ -58,7 +58,7 @@ public class TestDoc extends LuceneTestCase {* a few text files created in the current working directory.*/@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();workDir = new File(TEMP_DIR,"TestDoc");workDir.mkdirs();diff --git a/lucene/src/test/org/apache/lucene/index/TestDocumentWriter.java b/lucene/src/test/org/apache/lucene/index/TestDocumentWriter.javaindex 949e1ed3e6b..0cb8a0d7a4b 100644--- a/lucene/src/test/org/apache/lucene/index/TestDocumentWriter.java+++ b/lucene/src/test/org/apache/lucene/index/TestDocumentWriter.java@@ -42,19 +42,15 @@ import org.apache.lucene.util.BytesRef;public class TestDocumentWriter extends LuceneTestCase {private Directory dir;-- public TestDocumentWriter(String s) {- super(s);- }@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();dir = newDirectory();}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {dir.close();super.tearDown();}diff --git a/lucene/src/test/org/apache/lucene/index/TestFieldInfos.java b/lucene/src/test/org/apache/lucene/index/TestFieldInfos.javaindex 386906fbf70..566b90079a1 100644--- a/lucene/src/test/org/apache/lucene/index/TestFieldInfos.java+++ b/lucene/src/test/org/apache/lucene/index/TestFieldInfos.java@@ -30,12 +30,8 @@ public class TestFieldInfos extends LuceneTestCase {private Document testDoc = new Document();- public TestFieldInfos(String s) {- super(s);- }-@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();DocHelper.setupDoc(testDoc);}diff --git a/lucene/src/test/org/apache/lucene/index/TestFieldsReader.java b/lucene/src/test/org/apache/lucene/index/TestFieldsReader.javaindex 012743ea7b0..ca6d0d27a60 100644--- a/lucene/src/test/org/apache/lucene/index/TestFieldsReader.java+++ b/lucene/src/test/org/apache/lucene/index/TestFieldsReader.java@@ -48,12 +48,8 @@ public class TestFieldsReader extends LuceneTestCase {private FieldInfos fieldInfos = null;private final static String TEST_SEGMENT_NAME = "_0";- public TestFieldsReader(String s) {- super(s);- }-@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();fieldInfos = new FieldInfos();DocHelper.setupDoc(testDoc);@@ -68,7 +64,7 @@ public class TestFieldsReader extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {dir.close();super.tearDown();}diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexCommit.java b/lucene/src/test/org/apache/lucene/index/TestIndexCommit.javaindex 4e36614a5d5..4760c1eb256 100644--- a/lucene/src/test/org/apache/lucene/index/TestIndexCommit.java+++ b/lucene/src/test/org/apache/lucene/index/TestIndexCommit.java@@ -24,10 +24,10 @@ import java.util.Collection;import java.util.Map;import org.apache.lucene.store.Directory;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.junit.Test;-public class TestIndexCommit extends LuceneTestCaseJ4 {+public class TestIndexCommit extends LuceneTestCase {@Testpublic void testEqualsHashCode() throws Exception {diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexReader.java b/lucene/src/test/org/apache/lucene/index/TestIndexReader.javaindex 59706cb2a76..bf16cb06d69 100644--- a/lucene/src/test/org/apache/lucene/index/TestIndexReader.java+++ b/lucene/src/test/org/apache/lucene/index/TestIndexReader.java@@ -30,9 +30,6 @@ import java.util.HashMap;import java.util.Set;import java.util.SortedSet;-import junit.framework.TestSuite;-import junit.textui.TestRunner;-import org.apache.lucene.analysis.MockAnalyzer;import org.apache.lucene.document.Document;import org.apache.lucene.document.Field;@@ -61,18 +58,6 @@ import org.apache.lucene.util.Bits;public class TestIndexReader extends LuceneTestCase{- /** Main for running test case by itself. */- public static void main(String args[]) {- TestRunner.run (new TestSuite(TestIndexReader.class));-// TestRunner.run (new TestIndexReader("testBasicDelete"));-// TestRunner.run (new TestIndexReader("testDeleteReaderWriterConflict"));-// TestRunner.run (new TestIndexReader("testDeleteReaderReaderConflict"));-// TestRunner.run (new TestIndexReader("testFilesOpenClose"));- }-- public TestIndexReader(String name) {- super(name);- }public void testCommitUserData() throws Exception {Directory d = newDirectory();diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java b/lucene/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.javaindex 51c03f11cfb..b25d0e53b6f 100644--- a/lucene/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java+++ b/lucene/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java@@ -65,12 +65,8 @@ public class TestIndexReaderCloneNorms extends LuceneTestCase {private float normDelta = (float) 0.001;- public TestIndexReaderCloneNorms(String s) {- super(s);- }-@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();similarityOne = new SimilarityOne();anlzr = new MockAnalyzer();diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java b/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.javaindex 43d6cda637b..7965af6c1de 100644--- a/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java+++ b/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java@@ -45,7 +45,7 @@ import org.apache.lucene.store.AlreadyClosedException;import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util.BitVector;import org.apache.lucene.util.Bits;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;public class TestIndexReaderReopen extends LuceneTestCase {@@ -947,7 +947,7 @@ public class TestIndexReaderReopen extends LuceneTestCase {public static void createIndex(Random random, Directory dir, boolean multiSegment) throws IOException {IndexWriter.unlock(dir);- IndexWriter w = new IndexWriter(dir, LuceneTestCaseJ4.newIndexWriterConfig(random,+ IndexWriter w = new IndexWriter(dir, LuceneTestCase.newIndexWriterConfig(random,TEST_VERSION_CURRENT, new MockAnalyzer()).setMergePolicy(new LogDocMergePolicy()));@@ -1093,7 +1093,7 @@ public class TestIndexReaderReopen extends LuceneTestCase {@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();indexDir = new File(TEMP_DIR, "IndexReaderReopen");}diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java b/lucene/src/test/org/apache/lucene/index/TestIndexWriter.javaindex 78bb1906026..ae790fff4c9 100644--- a/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java+++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java@@ -79,10 +79,6 @@ import org.apache.lucene.util.BytesRef;import org.apache.lucene.util.Bits;public class TestIndexWriter extends LuceneTestCase {-- public TestIndexWriter(String name) {- super(name);- }public void testDocCount() throws IOException {Directory dir = newDirectory();diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexWriterConfig.java b/lucene/src/test/org/apache/lucene/index/TestIndexWriterConfig.javaindex ba75af22970..b67e30f360a 100644--- a/lucene/src/test/org/apache/lucene/index/TestIndexWriterConfig.java+++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriterConfig.java@@ -34,10 +34,10 @@ import org.apache.lucene.index.codecs.CodecProvider;import org.apache.lucene.search.DefaultSimilarity;import org.apache.lucene.search.Similarity;import org.apache.lucene.store.Directory;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.junit.Test;-public class TestIndexWriterConfig extends LuceneTestCaseJ4 {+public class TestIndexWriterConfig extends LuceneTestCase {private static final class MySimilarity extends DefaultSimilarity {// Does not implement anything - used only for type checking on IndexWriterConfig.diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexWriterLockRelease.java b/lucene/src/test/org/apache/lucene/index/TestIndexWriterLockRelease.javaindex 22f268345b3..9192a13b509 100644--- a/lucene/src/test/org/apache/lucene/index/TestIndexWriterLockRelease.java+++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriterLockRelease.java@@ -36,7 +36,7 @@ public class TestIndexWriterLockRelease extends LuceneTestCase {private java.io.File __test_dir;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();if (this.__test_dir == null) {this.__test_dir = new File(TEMP_DIR, "testIndexWriter");@@ -53,7 +53,7 @@ public class TestIndexWriterLockRelease extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {if (this.__test_dir != null) {File[] files = this.__test_dir.listFiles();diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java b/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.javaindex 6b160a99b9b..f8850abb539 100644--- a/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java+++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java@@ -38,7 +38,7 @@ import org.apache.lucene.store.MockDirectoryWrapper;import org.apache.lucene.store.AlreadyClosedException;import org.apache.lucene.store.RAMDirectory;import org.apache.lucene.util.LuceneTestCase;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util._TestUtil;import org.apache.lucene.util.BytesRef;import org.apache.lucene.util.ThreadInterruptedException;@@ -484,7 +484,7 @@ public class TestIndexWriterReader extends LuceneTestCase {public static void createIndex(Random random, Directory dir1, String indexName,boolean multiSegment) throws IOException {- IndexWriter w = new IndexWriter(dir1, LuceneTestCaseJ4.newIndexWriterConfig(random,+ IndexWriter w = new IndexWriter(dir1, LuceneTestCase.newIndexWriterConfig(random,TEST_VERSION_CURRENT, new MockAnalyzer()).setMergePolicy(new LogDocMergePolicy()));for (int i = 0; i < 100; i++) {diff --git a/lucene/src/test/org/apache/lucene/index/TestIsCurrent.java b/lucene/src/test/org/apache/lucene/index/TestIsCurrent.javaindex 20aef0ba5fa..f389ececb0c 100644--- a/lucene/src/test/org/apache/lucene/index/TestIsCurrent.java+++ b/lucene/src/test/org/apache/lucene/index/TestIsCurrent.java@@ -29,7 +29,7 @@ import org.junit.Test;import java.io.IOException;-public class TestIsCurrent extends LuceneTestCaseJ4 {+public class TestIsCurrent extends LuceneTestCase {private RandomIndexWriter writer;diff --git a/lucene/src/test/org/apache/lucene/index/TestMultiReader.java b/lucene/src/test/org/apache/lucene/index/TestMultiReader.javaindex 158c7f068dd..c934b4dd952 100644--- a/lucene/src/test/org/apache/lucene/index/TestMultiReader.java+++ b/lucene/src/test/org/apache/lucene/index/TestMultiReader.java@@ -20,9 +20,6 @@ package org.apache.lucene.index;import java.io.IOException;public class TestMultiReader extends TestDirectoryReader {- public TestMultiReader(String s) {- super(s);- }@Overrideprotected IndexReader openReader() throws IOException {diff --git a/lucene/src/test/org/apache/lucene/index/TestNoDeletionPolicy.java b/lucene/src/test/org/apache/lucene/index/TestNoDeletionPolicy.javaindex 8ef7e93757c..0ff9d09e9d2 100644--- a/lucene/src/test/org/apache/lucene/index/TestNoDeletionPolicy.java+++ b/lucene/src/test/org/apache/lucene/index/TestNoDeletionPolicy.java@@ -31,10 +31,10 @@ import org.apache.lucene.document.Field;import org.apache.lucene.document.Field.Index;import org.apache.lucene.document.Field.Store;import org.apache.lucene.store.Directory;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.junit.Test;-public class TestNoDeletionPolicy extends LuceneTestCaseJ4 {+public class TestNoDeletionPolicy extends LuceneTestCase {@Testpublic void testNoDeletionPolicy() throws Exception {diff --git a/lucene/src/test/org/apache/lucene/index/TestNoMergePolicy.java b/lucene/src/test/org/apache/lucene/index/TestNoMergePolicy.javaindex f36c2e55df8..62b2736f178 100644--- a/lucene/src/test/org/apache/lucene/index/TestNoMergePolicy.java+++ b/lucene/src/test/org/apache/lucene/index/TestNoMergePolicy.java@@ -24,10 +24,10 @@ import java.lang.reflect.Method;import java.lang.reflect.Modifier;import java.util.Arrays;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.junit.Test;-public class TestNoMergePolicy extends LuceneTestCaseJ4 {+public class TestNoMergePolicy extends LuceneTestCase {@Testpublic void testNoMergePolicy() throws Exception {diff --git a/lucene/src/test/org/apache/lucene/index/TestNoMergeScheduler.java b/lucene/src/test/org/apache/lucene/index/TestNoMergeScheduler.javaindex 75be77178a5..baff63e9e96 100644--- a/lucene/src/test/org/apache/lucene/index/TestNoMergeScheduler.java+++ b/lucene/src/test/org/apache/lucene/index/TestNoMergeScheduler.java@@ -24,10 +24,10 @@ import java.lang.reflect.Method;import java.lang.reflect.Modifier;import java.util.Arrays;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.junit.Test;-public class TestNoMergeScheduler extends LuceneTestCaseJ4 {+public class TestNoMergeScheduler extends LuceneTestCase {@Testpublic void testNoMergeScheduler() throws Exception {diff --git a/lucene/src/test/org/apache/lucene/index/TestNorms.java b/lucene/src/test/org/apache/lucene/index/TestNorms.javaindex 6bfa60a3373..77ab215e18a 100755--- a/lucene/src/test/org/apache/lucene/index/TestNorms.java+++ b/lucene/src/test/org/apache/lucene/index/TestNorms.java@@ -56,12 +56,8 @@ public class TestNorms extends LuceneTestCase {private float lastNorm = 0;private float normDelta = (float) 0.001;- public TestNorms(String s) {- super(s);- }-@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();similarityOne = new SimilarityOne();anlzr = new MockAnalyzer();diff --git a/lucene/src/test/org/apache/lucene/index/TestParallelReader.java b/lucene/src/test/org/apache/lucene/index/TestParallelReader.javaindex f17343bdb71..a9a20f37fff 100644--- a/lucene/src/test/org/apache/lucene/index/TestParallelReader.java+++ b/lucene/src/test/org/apache/lucene/index/TestParallelReader.java@@ -42,14 +42,14 @@ public class TestParallelReader extends LuceneTestCase {private Directory dir, dir1, dir2;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();single = single(random);parallel = parallel(random);}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {single.getIndexReader().close();parallel.getIndexReader().close();dir.close();diff --git a/lucene/src/test/org/apache/lucene/index/TestParallelTermEnum.java b/lucene/src/test/org/apache/lucene/index/TestParallelTermEnum.javaindex c296801410e..632a7a7fcc4 100755--- a/lucene/src/test/org/apache/lucene/index/TestParallelTermEnum.java+++ b/lucene/src/test/org/apache/lucene/index/TestParallelTermEnum.java@@ -35,7 +35,7 @@ public class TestParallelTermEnum extends LuceneTestCase {private Directory rd2;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();Document doc;rd1 = newDirectory();@@ -68,7 +68,7 @@ public class TestParallelTermEnum extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {ir1.close();ir2.close();rd1.close();diff --git a/lucene/src/test/org/apache/lucene/index/TestPayloadProcessorProvider.java b/lucene/src/test/org/apache/lucene/index/TestPayloadProcessorProvider.javaindex 94fd5a2f180..7909aedeb60 100644--- a/lucene/src/test/org/apache/lucene/index/TestPayloadProcessorProvider.java+++ b/lucene/src/test/org/apache/lucene/index/TestPayloadProcessorProvider.java@@ -38,10 +38,10 @@ import org.apache.lucene.index.PayloadProcessorProvider.PayloadProcessor;import org.apache.lucene.search.DocIdSetIterator;import org.apache.lucene.store.Directory;import org.apache.lucene.util.BytesRef;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.junit.Test;-public class TestPayloadProcessorProvider extends LuceneTestCaseJ4 {+public class TestPayloadProcessorProvider extends LuceneTestCase {private static final class PerDirPayloadProcessor extends PayloadProcessorProvider {diff --git a/lucene/src/test/org/apache/lucene/index/TestPositionBasedTermVectorMapper.java b/lucene/src/test/org/apache/lucene/index/TestPositionBasedTermVectorMapper.javaindex 62cf45a488d..1575c86cf75 100644--- a/lucene/src/test/org/apache/lucene/index/TestPositionBasedTermVectorMapper.java+++ b/lucene/src/test/org/apache/lucene/index/TestPositionBasedTermVectorMapper.java@@ -28,13 +28,8 @@ public class TestPositionBasedTermVectorMapper extends LuceneTestCase {protected TermVectorOffsetInfo[][] offsets;protected int numPositions;-- public TestPositionBasedTermVectorMapper(String s) {- super(s);- }-@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();tokens = new String[]{"here", "is", "some", "text", "to", "test", "extra"};thePositions = new int[tokens.length][];diff --git a/lucene/src/test/org/apache/lucene/index/TestSegmentMerger.java b/lucene/src/test/org/apache/lucene/index/TestSegmentMerger.javaindex 4227e827839..60a80f651d8 100644--- a/lucene/src/test/org/apache/lucene/index/TestSegmentMerger.java+++ b/lucene/src/test/org/apache/lucene/index/TestSegmentMerger.java@@ -39,14 +39,9 @@ public class TestSegmentMerger extends LuceneTestCase {private Directory merge2Dir;private Document doc2 = new Document();private SegmentReader reader2 = null;--- public TestSegmentMerger(String s) {- super(s);- }@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();mergedDir = newDirectory();merge1Dir = newDirectory();@@ -60,7 +55,7 @@ public class TestSegmentMerger extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {reader1.close();reader2.close();mergedDir.close();diff --git a/lucene/src/test/org/apache/lucene/index/TestSegmentReader.java b/lucene/src/test/org/apache/lucene/index/TestSegmentReader.javaindex 49c722c727f..6a22e5cc144 100644--- a/lucene/src/test/org/apache/lucene/index/TestSegmentReader.java+++ b/lucene/src/test/org/apache/lucene/index/TestSegmentReader.java@@ -34,14 +34,10 @@ public class TestSegmentReader extends LuceneTestCase {private Directory dir;private Document testDoc = new Document();private SegmentReader reader = null;-- public TestSegmentReader(String s) {- super(s);- }//TODO: Setup the reader w/ multiple documents@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();dir = newDirectory();DocHelper.setupDoc(testDoc);@@ -50,7 +46,7 @@ public class TestSegmentReader extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {reader.close();dir.close();super.tearDown();diff --git a/lucene/src/test/org/apache/lucene/index/TestSegmentTermDocs.java b/lucene/src/test/org/apache/lucene/index/TestSegmentTermDocs.javaindex 48092c74a41..284e4818077 100644--- a/lucene/src/test/org/apache/lucene/index/TestSegmentTermDocs.java+++ b/lucene/src/test/org/apache/lucene/index/TestSegmentTermDocs.java@@ -31,12 +31,8 @@ public class TestSegmentTermDocs extends LuceneTestCase {private Directory dir;private SegmentInfo info;- public TestSegmentTermDocs(String s) {- super(s);- }-@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();dir = newDirectory();DocHelper.setupDoc(testDoc);@@ -44,7 +40,7 @@ public class TestSegmentTermDocs extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {dir.close();super.tearDown();}diff --git a/lucene/src/test/org/apache/lucene/index/TestSnapshotDeletionPolicy.java b/lucene/src/test/org/apache/lucene/index/TestSnapshotDeletionPolicy.javaindex a844b1f7b05..9ae5df442ed 100644--- a/lucene/src/test/org/apache/lucene/index/TestSnapshotDeletionPolicy.java+++ b/lucene/src/test/org/apache/lucene/index/TestSnapshotDeletionPolicy.java@@ -19,7 +19,7 @@ import org.apache.lucene.index.IndexWriterConfig;import org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy;import org.apache.lucene.index.IndexWriter;import org.apache.lucene.index.SnapshotDeletionPolicy;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util.ThreadInterruptedException;import org.apache.lucene.util._TestUtil;import org.junit.Test;@@ -29,7 +29,7 @@ import org.junit.Test;// http://lucenebook.com//-public class TestSnapshotDeletionPolicy extends LuceneTestCaseJ4 {+public class TestSnapshotDeletionPolicy extends LuceneTestCase {public static final String INDEX_PATH = "test.snapshots";protected IndexWriterConfig getConfig(Random random, IndexDeletionPolicy dp) {diff --git a/lucene/src/test/org/apache/lucene/index/TestStressIndexing.java b/lucene/src/test/org/apache/lucene/index/TestStressIndexing.javaindex 485e7b9c994..47752682eaa 100644--- a/lucene/src/test/org/apache/lucene/index/TestStressIndexing.java+++ b/lucene/src/test/org/apache/lucene/index/TestStressIndexing.java@@ -22,10 +22,12 @@ import org.apache.lucene.analysis.MockAnalyzer;import org.apache.lucene.document.*;import org.apache.lucene.index.IndexWriterConfig.OpenMode;import org.apache.lucene.search.*;+import org.junit.runner.RunWith;import java.io.File;-public class TestStressIndexing extends MultiCodecTestCase {+@RunWith(LuceneTestCase.MultiCodecTestCaseRunner.class)+public class TestStressIndexing extends LuceneTestCase {private static abstract class TimedThread extends Thread {volatile boolean failed;int count;diff --git a/lucene/src/test/org/apache/lucene/index/TestStressIndexing2.java b/lucene/src/test/org/apache/lucene/index/TestStressIndexing2.javaindex 6a82e32d4dc..f1260f3dd99 100644--- a/lucene/src/test/org/apache/lucene/index/TestStressIndexing2.java+++ b/lucene/src/test/org/apache/lucene/index/TestStressIndexing2.java@@ -35,8 +35,10 @@ import org.apache.lucene.document.Fieldable;import org.apache.lucene.index.IndexWriterConfig.OpenMode;import org.apache.lucene.search.TermQuery;import org.apache.lucene.store.Directory;+import org.junit.runner.RunWith;-public class TestStressIndexing2 extends MultiCodecTestCase {+@RunWith(LuceneTestCase.MultiCodecTestCaseRunner.class)+public class TestStressIndexing2 extends LuceneTestCase {static int maxFields=4;static int bigFieldSize=10;static boolean sameFieldOrder=false;@@ -236,7 +238,7 @@ public class TestStressIndexing2 extends MultiCodecTestCase {public static void indexSerial(Random random, Map<String,Document> docs, Directory dir) throws IOException {- IndexWriter w = new IndexWriter(dir, LuceneTestCaseJ4.newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));+ IndexWriter w = new IndexWriter(dir, LuceneTestCase.newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer()));// index all docs in a single threadIterator<Document> iter = docs.values().iterator();diff --git a/lucene/src/test/org/apache/lucene/index/TestTermVectorsReader.java b/lucene/src/test/org/apache/lucene/index/TestTermVectorsReader.javaindex 6ea2562d343..0fa239178d3 100644--- a/lucene/src/test/org/apache/lucene/index/TestTermVectorsReader.java+++ b/lucene/src/test/org/apache/lucene/index/TestTermVectorsReader.java@@ -48,10 +48,6 @@ public class TestTermVectorsReader extends LuceneTestCase {private FieldInfos fieldInfos = new FieldInfos();private static int TERM_FREQ = 3;- public TestTermVectorsReader(String s) {- super(s);- }-private class TestToken implements Comparable<TestToken> {String text;int pos;@@ -65,7 +61,7 @@ public class TestTermVectorsReader extends LuceneTestCase {TestToken[] tokens = new TestToken[testTerms.length * TERM_FREQ];@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();/*for (int i = 0; i < testFields.length; i++) {@@ -125,7 +121,7 @@ public class TestTermVectorsReader extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {dir.close();super.tearDown();}diff --git a/lucene/src/test/org/apache/lucene/index/TestTransactionRollback.java b/lucene/src/test/org/apache/lucene/index/TestTransactionRollback.javaindex 6a24a8aad1d..1b6b85b714d 100644--- a/lucene/src/test/org/apache/lucene/index/TestTransactionRollback.java+++ b/lucene/src/test/org/apache/lucene/index/TestTransactionRollback.java@@ -122,7 +122,7 @@ public class TestTransactionRollback extends LuceneTestCase {*/@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();dir = newDirectory();//Build index, of records 1 to 100, committing after each batch of 10@@ -144,7 +144,7 @@ public class TestTransactionRollback extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {dir.close();super.tearDown();}diff --git a/lucene/src/test/org/apache/lucene/index/codecs/preflex/TestSurrogates.java b/lucene/src/test/org/apache/lucene/index/codecs/preflex/TestSurrogates.javaindex 46663df8e16..720fa5059af 100644--- a/lucene/src/test/org/apache/lucene/index/codecs/preflex/TestSurrogates.java+++ b/lucene/src/test/org/apache/lucene/index/codecs/preflex/TestSurrogates.java@@ -30,7 +30,7 @@ import java.io.IOException;import static org.junit.Assert.*;import org.junit.Test;-public class TestSurrogates extends LuceneTestCaseJ4 {+public class TestSurrogates extends LuceneTestCase {private static String makeDifficultRandomUnicodeString(Random r) {final int end = r.nextInt(20);diff --git a/lucene/src/test/org/apache/lucene/index/codecs/preflexrw/PreFlexRWCodec.java b/lucene/src/test/org/apache/lucene/index/codecs/preflexrw/PreFlexRWCodec.javaindex 653025e2f3a..5a2d9477216 100644--- a/lucene/src/test/org/apache/lucene/index/codecs/preflexrw/PreFlexRWCodec.java+++ b/lucene/src/test/org/apache/lucene/index/codecs/preflexrw/PreFlexRWCodec.java@@ -25,7 +25,7 @@ import org.apache.lucene.index.codecs.preflex.PreFlexCodec;import org.apache.lucene.index.codecs.preflex.PreFlexFields;import org.apache.lucene.index.codecs.FieldsConsumer;import org.apache.lucene.index.codecs.FieldsProducer;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;/** Codec, only for testing, that can write and read the* pre-flex index format.@@ -63,7 +63,7 @@ public class PreFlexRWCodec extends PreFlexCodec {//System.out.println(trace[i].getClassName());if ("merge".equals(trace[i].getMethodName())) {unicodeSortOrder = false;- if (LuceneTestCaseJ4.VERBOSE) {+ if (LuceneTestCase.VERBOSE) {System.out.println("NOTE: PreFlexRW codec: forcing legacy UTF16 term sort order");}break;diff --git a/lucene/src/test/org/apache/lucene/messages/TestNLS.java b/lucene/src/test/org/apache/lucene/messages/TestNLS.javaindex 28d51f674bd..41f71eb7c92 100644--- a/lucene/src/test/org/apache/lucene/messages/TestNLS.java+++ b/lucene/src/test/org/apache/lucene/messages/TestNLS.java@@ -19,11 +19,13 @@ package org.apache.lucene.messages;import java.util.Locale;-import org.apache.lucene.util.LocalizedTestCase;+import org.apache.lucene.util.LuceneTestCase;+import org.junit.runner.RunWith;/***/-public class TestNLS extends LocalizedTestCase {+@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)+public class TestNLS extends LuceneTestCase {public void testMessageLoading() {Message invalidSyntax = new MessageImpl(MessagesTestBundle.Q0001E_INVALID_SYNTAX, "XXX");diff --git a/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java b/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.javaindex a7ef9377514..119e842252d 100644--- a/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java+++ b/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java@@ -60,23 +60,17 @@ import org.apache.lucene.search.TermQuery;import org.apache.lucene.search.WildcardQuery;import org.apache.lucene.search.BooleanClause.Occur;import org.apache.lucene.store.Directory;-import org.apache.lucene.util.LocalizedTestCase;+import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util.automaton.BasicAutomata;import org.apache.lucene.util.automaton.CharacterRunAutomaton;import org.apache.lucene.util.automaton.RegExp;+import org.junit.runner.RunWith;/*** Tests QueryParser.*/-public class TestQueryParser extends LocalizedTestCase {-- public TestQueryParser(String name) {- super(name, new HashSet<String>(Arrays.asList(- "testLegacyDateRange", "testDateRange",- "testCJK", "testNumber", "testFarsiRangeCollating",- "testLocalDateFormat"- )));- }+@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)+public class TestQueryParser extends LuceneTestCase {public static Analyzer qpAnalyzer = new QPTestAnalyzer();@@ -150,7 +144,7 @@ public class TestQueryParser extends LocalizedTestCase {private int originalMaxClauses;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();originalMaxClauses = BooleanQuery.getMaxClauseCount();}@@ -1142,7 +1136,7 @@ public class TestQueryParser extends LocalizedTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {BooleanQuery.setMaxClauseCount(originalMaxClauses);super.tearDown();}diff --git a/lucene/src/test/org/apache/lucene/search/BaseTestRangeFilter.java b/lucene/src/test/org/apache/lucene/search/BaseTestRangeFilter.javaindex 74fde1d287c..91dca227f8c 100644--- a/lucene/src/test/org/apache/lucene/search/BaseTestRangeFilter.java+++ b/lucene/src/test/org/apache/lucene/search/BaseTestRangeFilter.java@@ -20,7 +20,7 @@ package org.apache.lucene.search;import java.io.IOException;import java.util.Random;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util._TestUtil;import org.apache.lucene.analysis.MockAnalyzer;import org.apache.lucene.document.Document;@@ -34,7 +34,7 @@ import org.junit.BeforeClass;import org.junit.Test;import static org.junit.Assert.*;-public class BaseTestRangeFilter extends LuceneTestCaseJ4 {+public class BaseTestRangeFilter extends LuceneTestCase {public static final boolean F = false;public static final boolean T = true;diff --git a/lucene/src/test/org/apache/lucene/search/MultiCollectorTest.java b/lucene/src/test/org/apache/lucene/search/MultiCollectorTest.javaindex a2718eeb0f1..f995a2ad5e4 100644--- a/lucene/src/test/org/apache/lucene/search/MultiCollectorTest.java+++ b/lucene/src/test/org/apache/lucene/search/MultiCollectorTest.java@@ -24,10 +24,10 @@ import java.io.IOException;import org.apache.lucene.index.IndexReader;import org.apache.lucene.search.Collector;import org.apache.lucene.search.Scorer;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.junit.Test;-public class MultiCollectorTest extends LuceneTestCaseJ4 {+public class MultiCollectorTest extends LuceneTestCase {private static class DummyCollector extends Collector {diff --git a/lucene/src/test/org/apache/lucene/search/QueryUtils.java b/lucene/src/test/org/apache/lucene/search/QueryUtils.javaindex ce21bca4cba..e41cb989340 100644--- a/lucene/src/test/org/apache/lucene/search/QueryUtils.java+++ b/lucene/src/test/org/apache/lucene/search/QueryUtils.java@@ -18,7 +18,7 @@ import org.apache.lucene.store.Directory;import org.apache.lucene.store.MockDirectoryWrapper;import org.apache.lucene.store.RAMDirectory;-import static org.apache.lucene.util.LuceneTestCaseJ4.TEST_VERSION_CURRENT;+import static org.apache.lucene.util.LuceneTestCase.TEST_VERSION_CURRENT;/*** Copyright 2005 Apache Software Foundationdiff --git a/lucene/src/test/org/apache/lucene/search/TestBoolean2.java b/lucene/src/test/org/apache/lucene/search/TestBoolean2.javaindex 6ee9fa60c33..34cab5c1075 100644--- a/lucene/src/test/org/apache/lucene/search/TestBoolean2.java+++ b/lucene/src/test/org/apache/lucene/search/TestBoolean2.java@@ -31,7 +31,7 @@ import org.apache.lucene.queryParser.QueryParser;import org.apache.lucene.store.Directory;import org.apache.lucene.store.MockDirectoryWrapper;import org.apache.lucene.store.RAMDirectory;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util._TestUtil;import org.junit.AfterClass;import org.junit.BeforeClass;@@ -42,7 +42,7 @@ import static org.junit.Assert.*;/** Test BooleanQuery2 against BooleanQuery by overriding the standard query parser.* This also tests the scoring order of BooleanQuery.*/-public class TestBoolean2 extends LuceneTestCaseJ4 {+public class TestBoolean2 extends LuceneTestCase {private static IndexSearcher searcher;private static IndexSearcher bigSearcher;private static IndexReader reader;diff --git a/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java b/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.javaindex 9d2d4a2a30f..afcf05ad798 100644--- a/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java+++ b/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java@@ -37,7 +37,7 @@ public class TestBooleanMinShouldMatch extends LuceneTestCase {private IndexSearcher s;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();String[] data = new String [] {@@ -71,7 +71,7 @@ public class TestBooleanMinShouldMatch extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {s.close();r.close();index.close();diff --git a/lucene/src/test/org/apache/lucene/search/TestBooleanOr.java b/lucene/src/test/org/apache/lucene/search/TestBooleanOr.javaindex 6969fb38965..8292575d483 100644--- a/lucene/src/test/org/apache/lucene/search/TestBooleanOr.java+++ b/lucene/src/test/org/apache/lucene/search/TestBooleanOr.java@@ -131,7 +131,7 @@ public class TestBooleanOr extends LuceneTestCase {}@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();//@@ -164,7 +164,7 @@ public class TestBooleanOr extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher.close();reader.close();dir.close();diff --git a/lucene/src/test/org/apache/lucene/search/TestBooleanPrefixQuery.java b/lucene/src/test/org/apache/lucene/search/TestBooleanPrefixQuery.javaindex e1b6d516e3b..a5f834d559d 100644--- a/lucene/src/test/org/apache/lucene/search/TestBooleanPrefixQuery.java+++ b/lucene/src/test/org/apache/lucene/search/TestBooleanPrefixQuery.java@@ -18,9 +18,6 @@ package org.apache.lucene.search;*/import org.apache.lucene.util.LuceneTestCase;-import junit.framework.Test;-import junit.framework.TestSuite;-import junit.textui.TestRunner;import org.apache.lucene.index.RandomIndexWriter;import org.apache.lucene.index.Term;import org.apache.lucene.index.IndexReader;@@ -37,18 +34,6 @@ import org.apache.lucene.store.Directory;public class TestBooleanPrefixQuery extends LuceneTestCase {- public static void main(String[] args) {- TestRunner.run(suite());- }-- public static Test suite() {- return new TestSuite(TestBooleanPrefixQuery.class);- }-- public TestBooleanPrefixQuery(String name) {- super(name);- }-private int getCount(IndexReader r, Query q) throws Exception {if (q instanceof BooleanQuery) {return ((BooleanQuery) q).getClauses().length;diff --git a/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java b/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.javaindex de0e77cb6db..297aabe3f4c 100644--- a/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java+++ b/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java@@ -31,11 +31,6 @@ import org.apache.lucene.util.LuceneTestCase;public class TestBooleanScorer extends LuceneTestCase{-- public TestBooleanScorer(String name) {- super(name);- }-private static final String FIELD = "category";public void testMethod() throws Exception {diff --git a/lucene/src/test/org/apache/lucene/search/TestComplexExplanations.java b/lucene/src/test/org/apache/lucene/search/TestComplexExplanations.javaindex 46ae50c0fdb..da1d75668de 100644--- a/lucene/src/test/org/apache/lucene/search/TestComplexExplanations.java+++ b/lucene/src/test/org/apache/lucene/search/TestComplexExplanations.java@@ -32,7 +32,7 @@ public class TestComplexExplanations extends TestExplanations {* nice with boosts of 0.0*/@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();searcher.setSimilarity(createQnorm1Similarity());}diff --git a/lucene/src/test/org/apache/lucene/search/TestCustomSearcherSort.java b/lucene/src/test/org/apache/lucene/search/TestCustomSearcherSort.javaindex 082f5c3072c..062afc69bfd 100644--- a/lucene/src/test/org/apache/lucene/search/TestCustomSearcherSort.java+++ b/lucene/src/test/org/apache/lucene/search/TestCustomSearcherSort.java@@ -46,7 +46,7 @@ public class TestCustomSearcherSort extends LuceneTestCase implements Serializab* Create index and query for test cases.*/@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();index = newDirectory();RandomIndexWriter writer = new RandomIndexWriter(random, index);@@ -74,7 +74,7 @@ public class TestCustomSearcherSort extends LuceneTestCase implements Serializab}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {reader.close();index.close();super.tearDown();diff --git a/lucene/src/test/org/apache/lucene/search/TestDateFilter.java b/lucene/src/test/org/apache/lucene/search/TestDateFilter.javaindex 588057c7427..7a3ce2cf96b 100644--- a/lucene/src/test/org/apache/lucene/search/TestDateFilter.java+++ b/lucene/src/test/org/apache/lucene/search/TestDateFilter.java@@ -35,10 +35,7 @@ import java.io.IOException;* @version $Revision$*/public class TestDateFilter extends LuceneTestCase {- public TestDateFilter(String name) {- super(name);- }-+/****/diff --git a/lucene/src/test/org/apache/lucene/search/TestDateSort.java b/lucene/src/test/org/apache/lucene/search/TestDateSort.javaindex 8c0a34e9cba..40627d0b5f9 100644--- a/lucene/src/test/org/apache/lucene/search/TestDateSort.java+++ b/lucene/src/test/org/apache/lucene/search/TestDateSort.java@@ -47,7 +47,7 @@ public class TestDateSort extends LuceneTestCase {private IndexReader reader;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();// Create an index writer.directory = newDirectory();@@ -71,7 +71,7 @@ public class TestDateSort extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {reader.close();directory.close();super.tearDown();diff --git a/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java b/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.javaindex 957808ade54..2833c0ecd97 100644--- a/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java+++ b/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java@@ -75,7 +75,7 @@ public class TestDisjunctionMaxQuery extends LuceneTestCase {public IndexSearcher s;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();index = newDirectory();@@ -150,7 +150,7 @@ public class TestDisjunctionMaxQuery extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {s.close();r.close();index.close();diff --git a/lucene/src/test/org/apache/lucene/search/TestDocBoost.java b/lucene/src/test/org/apache/lucene/search/TestDocBoost.javaindex 81984796adb..2555896ac1d 100644--- a/lucene/src/test/org/apache/lucene/search/TestDocBoost.java+++ b/lucene/src/test/org/apache/lucene/search/TestDocBoost.java@@ -32,9 +32,6 @@ import org.apache.lucene.store.Directory;* @version $Revision$*/public class TestDocBoost extends LuceneTestCase {- public TestDocBoost(String name) {- super(name);- }public void testDocBoost() throws Exception {Directory store = newDirectory();diff --git a/lucene/src/test/org/apache/lucene/search/TestExplanations.java b/lucene/src/test/org/apache/lucene/search/TestExplanations.javaindex 65891eed5bb..76e44411095 100644--- a/lucene/src/test/org/apache/lucene/search/TestExplanations.java+++ b/lucene/src/test/org/apache/lucene/search/TestExplanations.java@@ -57,7 +57,7 @@ public class TestExplanations extends LuceneTestCase {new QueryParser(TEST_VERSION_CURRENT, FIELD, new MockAnalyzer());@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher.close();reader.close();directory.close();@@ -65,7 +65,7 @@ public class TestExplanations extends LuceneTestCase {}@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = newDirectory();RandomIndexWriter writer= new RandomIndexWriter(random, directory);diff --git a/lucene/src/test/org/apache/lucene/search/TestFieldCache.java b/lucene/src/test/org/apache/lucene/search/TestFieldCache.javaindex b0e03d23563..70e1acf334f 100644--- a/lucene/src/test/org/apache/lucene/search/TestFieldCache.java+++ b/lucene/src/test/org/apache/lucene/search/TestFieldCache.java@@ -36,13 +36,9 @@ public class TestFieldCache extends LuceneTestCase {private static final int NUM_DOCS = 1000 * RANDOM_MULTIPLIER;private String[] unicodeStrings;private Directory directory;-- public TestFieldCache(String s) {- super(s);- }@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = newDirectory();RandomIndexWriter writer= new RandomIndexWriter(random, directory);@@ -86,7 +82,7 @@ public class TestFieldCache extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {reader.close();directory.close();super.tearDown();diff --git a/lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java b/lucene/src/test/org/apache/lucene/search/TestFilteredQuery.javaindex e60e4f8343a..64c4708ea90 100644--- a/lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java+++ b/lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java@@ -45,7 +45,7 @@ public class TestFilteredQuery extends LuceneTestCase {private Filter filter;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = newDirectory();RandomIndexWriter writer = new RandomIndexWriter (random, directory);@@ -97,7 +97,7 @@ public class TestFilteredQuery extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher.close();reader.close();directory.close();diff --git a/lucene/src/test/org/apache/lucene/search/TestFilteredSearch.java b/lucene/src/test/org/apache/lucene/search/TestFilteredSearch.javaindex fb3e64e6a80..951abdd246c 100644--- a/lucene/src/test/org/apache/lucene/search/TestFilteredSearch.java+++ b/lucene/src/test/org/apache/lucene/search/TestFilteredSearch.java@@ -38,10 +38,6 @@ import org.apache.lucene.util.OpenBitSet;*/public class TestFilteredSearch extends LuceneTestCase {- public TestFilteredSearch(String name) {- super(name);- }-private static final String FIELD = "category";public void testFilteredSearch() throws CorruptIndexException, LockObtainFailedException, IOException {diff --git a/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java b/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.javaindex 162c155be75..43e3d5ad713 100644--- a/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java+++ b/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java@@ -38,9 +38,6 @@ import java.util.LinkedList;**/public class TestMultiPhraseQuery extends LuceneTestCase {- public TestMultiPhraseQuery(String name) {- super(name);- }public void testPhrasePrefix() throws IOException {Directory indexStore = newDirectory();diff --git a/lucene/src/test/org/apache/lucene/search/TestMultiSearcher.java b/lucene/src/test/org/apache/lucene/search/TestMultiSearcher.javaindex 858237180d1..e46f3ba58e0 100644--- a/lucene/src/test/org/apache/lucene/search/TestMultiSearcher.java+++ b/lucene/src/test/org/apache/lucene/search/TestMultiSearcher.java@@ -18,7 +18,7 @@ package org.apache.lucene.search;*/import org.apache.lucene.util.LuceneTestCase;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.analysis.MockAnalyzer;import org.apache.lucene.document.Document;import org.apache.lucene.document.Field;@@ -42,11 +42,6 @@ import java.util.Set;*/public class TestMultiSearcher extends LuceneTestCase{-- public TestMultiSearcher(String name)- {- super(name);- }/*** ReturnS a new instance of the concrete MultiSearcher class@@ -221,7 +216,7 @@ public class TestMultiSearcher extends LuceneTestCaseIndexWriter indexWriter=null;try {- indexWriter = new IndexWriter(directory, LuceneTestCaseJ4.newIndexWriterConfig(random,+ indexWriter = new IndexWriter(directory, LuceneTestCase.newIndexWriterConfig(random,TEST_VERSION_CURRENT, new MockAnalyzer()).setOpenMode(create ? OpenMode.CREATE : OpenMode.APPEND));diff --git a/lucene/src/test/org/apache/lucene/search/TestMultiSearcherRanking.java b/lucene/src/test/org/apache/lucene/search/TestMultiSearcherRanking.javaindex a69b57ddf2f..04972f0b8f6 100644--- a/lucene/src/test/org/apache/lucene/search/TestMultiSearcherRanking.java+++ b/lucene/src/test/org/apache/lucene/search/TestMultiSearcherRanking.java@@ -107,7 +107,7 @@ public class TestMultiSearcherRanking extends LuceneTestCase {* initializes multiSearcher and singleSearcher with the same document set*/@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();// create MultiSearcher from two seperate searchersd1 = newDirectory();@@ -136,7 +136,7 @@ public class TestMultiSearcherRanking extends LuceneTestCase {Directory d1, d2, d;@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {multiSearcher.close();singleSearcher.close();d1.close();diff --git a/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java b/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.javaindex f2a6ff73bdb..f5f9ec46483 100644--- a/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java+++ b/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java@@ -46,7 +46,7 @@ public class TestMultiTermConstantScore extends BaseTestRangeFilter {static Directory small;static IndexReader reader;- void assertEquals(String m, float e, float a) {+ static public void assertEquals(String m, float e, float a) {Assert.assertEquals(m, e, a, SCORE_COMP_THRESH);}diff --git a/lucene/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java b/lucene/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.javaindex 7281b72fe11..8c8cc1a76c3 100644--- a/lucene/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java+++ b/lucene/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java@@ -34,12 +34,8 @@ public class TestMultiThreadTermVectors extends LuceneTestCase {public int numDocs = 100;public int numThreads = 3;- public TestMultiThreadTermVectors(String s) {- super(s);- }-@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = newDirectory();IndexWriter writer = new IndexWriter(directory, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer()));@@ -56,7 +52,7 @@ public class TestMultiThreadTermVectors extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {directory.close();super.tearDown();}diff --git a/lucene/src/test/org/apache/lucene/search/TestNot.java b/lucene/src/test/org/apache/lucene/search/TestNot.javaindex 142479df6ff..a60b8edc20b 100644--- a/lucene/src/test/org/apache/lucene/search/TestNot.java+++ b/lucene/src/test/org/apache/lucene/search/TestNot.java@@ -33,9 +33,6 @@ import org.apache.lucene.document.Field;* @version $Revision$*/public class TestNot extends LuceneTestCase {- public TestNot(String name) {- super(name);- }public void testNot() throws Exception {Directory store = newDirectory();diff --git a/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java b/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery32.javaindex ee26456e910..7848ad12e96 100644--- a/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java+++ b/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java@@ -29,7 +29,7 @@ import org.apache.lucene.index.RandomIndexWriter;import org.apache.lucene.index.TermsEnum;import org.apache.lucene.store.Directory;import org.apache.lucene.util.BytesRef;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util.NumericUtils;import org.apache.lucene.util._TestUtil;@@ -38,7 +38,7 @@ import org.junit.AfterClass;import org.junit.BeforeClass;import static org.junit.Assert.*;-public class TestNumericRangeQuery32 extends LuceneTestCaseJ4 {+public class TestNumericRangeQuery32 extends LuceneTestCase {// distance of entriesprivate static final int distance = 6666;// shift the starting of the values to the left, to also have negative values:diff --git a/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java b/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery64.javaindex f3843da7f8d..151e9ed6716 100644--- a/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java+++ b/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java@@ -28,7 +28,7 @@ import org.apache.lucene.index.IndexWriter;import org.apache.lucene.index.RandomIndexWriter;import org.apache.lucene.store.Directory;import org.apache.lucene.util.BytesRef;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util.NumericUtils;import org.apache.lucene.util._TestUtil;@@ -37,7 +37,7 @@ import org.junit.AfterClass;import org.junit.BeforeClass;import static org.junit.Assert.*;-public class TestNumericRangeQuery64 extends LuceneTestCaseJ4 {+public class TestNumericRangeQuery64 extends LuceneTestCase {// distance of entriesprivate static final long distance = 66666L;// shift the starting of the values to the left, to also have negative values:diff --git a/lucene/src/test/org/apache/lucene/search/TestParallelMultiSearcher.java b/lucene/src/test/org/apache/lucene/search/TestParallelMultiSearcher.javaindex c37b4a54b23..ca4520ad36f 100644--- a/lucene/src/test/org/apache/lucene/search/TestParallelMultiSearcher.java+++ b/lucene/src/test/org/apache/lucene/search/TestParallelMultiSearcher.java@@ -24,10 +24,6 @@ import java.io.IOException;*/public class TestParallelMultiSearcher extends TestMultiSearcher {- public TestParallelMultiSearcher(String name) {- super(name);- }-@Overrideprotected MultiSearcher getMultiSearcherInstance(Searcher[] searchers)throws IOException {diff --git a/lucene/src/test/org/apache/lucene/search/TestPhrasePrefixQuery.java b/lucene/src/test/org/apache/lucene/search/TestPhrasePrefixQuery.javaindex 6de784d2b46..03985b1e879 100644--- a/lucene/src/test/org/apache/lucene/search/TestPhrasePrefixQuery.java+++ b/lucene/src/test/org/apache/lucene/search/TestPhrasePrefixQuery.java@@ -35,9 +35,6 @@ import java.util.LinkedList;* This class tests PhrasePrefixQuery class.*/public class TestPhrasePrefixQuery extends LuceneTestCase {- public TestPhrasePrefixQuery(String name) {- super(name);- }/***diff --git a/lucene/src/test/org/apache/lucene/search/TestPhraseQuery.java b/lucene/src/test/org/apache/lucene/search/TestPhraseQuery.javaindex 711f5206727..8384cf41467 100644--- a/lucene/src/test/org/apache/lucene/search/TestPhraseQuery.java+++ b/lucene/src/test/org/apache/lucene/search/TestPhraseQuery.java@@ -91,7 +91,7 @@ public class TestPhraseQuery extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher.close();reader.close();directory.close();diff --git a/lucene/src/test/org/apache/lucene/search/TestPrefixInBooleanQuery.java b/lucene/src/test/org/apache/lucene/search/TestPrefixInBooleanQuery.javaindex 7042b740211..ddafd662857 100644--- a/lucene/src/test/org/apache/lucene/search/TestPrefixInBooleanQuery.java+++ b/lucene/src/test/org/apache/lucene/search/TestPrefixInBooleanQuery.java@@ -43,7 +43,7 @@ public class TestPrefixInBooleanQuery extends LuceneTestCase {private IndexSearcher searcher;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = newDirectory();RandomIndexWriter writer = new RandomIndexWriter(random, directory);diff --git a/lucene/src/test/org/apache/lucene/search/TestPrefixRandom.java b/lucene/src/test/org/apache/lucene/search/TestPrefixRandom.javaindex d71c416be60..edf912e1c24 100644--- a/lucene/src/test/org/apache/lucene/search/TestPrefixRandom.java+++ b/lucene/src/test/org/apache/lucene/search/TestPrefixRandom.java@@ -43,7 +43,7 @@ public class TestPrefixRandom extends LuceneTestCase {private Directory dir;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();dir = newDirectory();RandomIndexWriter writer = new RandomIndexWriter(random, dir,@@ -68,7 +68,7 @@ public class TestPrefixRandom extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {reader.close();searcher.close();dir.close();diff --git a/lucene/src/test/org/apache/lucene/search/TestQueryTermVector.java b/lucene/src/test/org/apache/lucene/search/TestQueryTermVector.javaindex 18e9464bbbe..db3752b7d55 100644--- a/lucene/src/test/org/apache/lucene/search/TestQueryTermVector.java+++ b/lucene/src/test/org/apache/lucene/search/TestQueryTermVector.java@@ -23,11 +23,6 @@ import org.apache.lucene.analysis.MockAnalyzer;public class TestQueryTermVector extends LuceneTestCase {-- public TestQueryTermVector(String s) {- super(s);- }-public void testConstructor() {BytesRef [] queryTerm = {new BytesRef("foo"), new BytesRef("bar"), new BytesRef("foo"),new BytesRef("again"), new BytesRef("foo"), new BytesRef("bar"), new BytesRef("go"),diff --git a/lucene/src/test/org/apache/lucene/search/TestRegexpRandom.java b/lucene/src/test/org/apache/lucene/search/TestRegexpRandom.javaindex 8d7f99fa487..5dbbddd010f 100644--- a/lucene/src/test/org/apache/lucene/search/TestRegexpRandom.java+++ b/lucene/src/test/org/apache/lucene/search/TestRegexpRandom.java@@ -43,7 +43,7 @@ public class TestRegexpRandom extends LuceneTestCase {private Directory dir;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();dir = newDirectory();RandomIndexWriter writer = new RandomIndexWriter(random, dir,@@ -90,7 +90,7 @@ public class TestRegexpRandom extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher.close();reader.close();dir.close();diff --git a/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java b/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.javaindex 5acc42900c5..836ab46b84d 100644--- a/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java+++ b/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java@@ -51,7 +51,7 @@ public class TestRegexpRandom2 extends LuceneTestCase {private Directory dir;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();dir = newDirectory();RandomIndexWriter writer = new RandomIndexWriter(random, dir,@@ -85,7 +85,7 @@ public class TestRegexpRandom2 extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {reader.close();searcher.close();dir.close();diff --git a/lucene/src/test/org/apache/lucene/search/TestSetNorm.java b/lucene/src/test/org/apache/lucene/search/TestSetNorm.javaindex 16af57114ae..a117ee30c6b 100644--- a/lucene/src/test/org/apache/lucene/search/TestSetNorm.java+++ b/lucene/src/test/org/apache/lucene/search/TestSetNorm.java@@ -33,9 +33,6 @@ import org.apache.lucene.store.Directory;* @version $Revision$*/public class TestSetNorm extends LuceneTestCase {- public TestSetNorm(String name) {- super(name);- }public void testSetNorm() throws Exception {Directory store = newDirectory();diff --git a/lucene/src/test/org/apache/lucene/search/TestSimilarity.java b/lucene/src/test/org/apache/lucene/search/TestSimilarity.javaindex 62decc4e7bb..c516940f889 100644--- a/lucene/src/test/org/apache/lucene/search/TestSimilarity.java+++ b/lucene/src/test/org/apache/lucene/search/TestSimilarity.java@@ -36,9 +36,6 @@ import org.apache.lucene.search.Explanation.IDFExplanation;* @version $Revision$*/public class TestSimilarity extends LuceneTestCase {- public TestSimilarity(String name) {- super(name);- }public static class SimpleSimilarity extends Similarity {@Override public float lengthNorm(String field, int numTerms) { return 1.0f; }diff --git a/lucene/src/test/org/apache/lucene/search/TestSort.java b/lucene/src/test/org/apache/lucene/search/TestSort.javaindex f7418c3ba0e..17f92abc1e4 100644--- a/lucene/src/test/org/apache/lucene/search/TestSort.java+++ b/lucene/src/test/org/apache/lucene/search/TestSort.java@@ -69,15 +69,6 @@ public class TestSort extends LuceneTestCase implements Serializable {private Query queryG;private Sort sort;- public TestSort (String name) {- super (name);- }-- public static Test suite() {- return new TestSuite (TestSort.class);- }--// document data:// the tracer field is used to determine which document was hit// the contents field is used to search and sort by relevance@@ -209,7 +200,7 @@ public class TestSort extends LuceneTestCase implements Serializable {}@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();full = getFullIndex();searchX = getXIndex();@@ -226,7 +217,7 @@ public class TestSort extends LuceneTestCase implements Serializable {private ArrayList<Directory> dirs = new ArrayList<Directory>();@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {full.reader.close();searchX.reader.close();searchY.reader.close();diff --git a/lucene/src/test/org/apache/lucene/search/TestSpanQueryFilter.java b/lucene/src/test/org/apache/lucene/search/TestSpanQueryFilter.javaindex 12a64c74286..cb3b846958b 100644--- a/lucene/src/test/org/apache/lucene/search/TestSpanQueryFilter.java+++ b/lucene/src/test/org/apache/lucene/search/TestSpanQueryFilter.java@@ -31,11 +31,6 @@ import org.apache.lucene.util.LuceneTestCase;public class TestSpanQueryFilter extends LuceneTestCase {-- public TestSpanQueryFilter(String s) {- super(s);- }-public void testFilterWorks() throws Exception {Directory dir = newDirectory();RandomIndexWriter writer = new RandomIndexWriter(random, dir);diff --git a/lucene/src/test/org/apache/lucene/search/TestSubScorerFreqs.java b/lucene/src/test/org/apache/lucene/search/TestSubScorerFreqs.javaindex 8c725679ab6..d4e5053c600 100644--- a/lucene/src/test/org/apache/lucene/search/TestSubScorerFreqs.java+++ b/lucene/src/test/org/apache/lucene/search/TestSubScorerFreqs.java@@ -33,7 +33,7 @@ import org.junit.BeforeClass;import static org.junit.Assert.*;-public class TestSubScorerFreqs extends LuceneTestCaseJ4 {+public class TestSubScorerFreqs extends LuceneTestCase {private static Directory dir;private static IndexSearcher s;diff --git a/lucene/src/test/org/apache/lucene/search/TestTermRangeQuery.java b/lucene/src/test/org/apache/lucene/search/TestTermRangeQuery.javaindex 3c8c847386f..d5f3bd89224 100644--- a/lucene/src/test/org/apache/lucene/search/TestTermRangeQuery.java+++ b/lucene/src/test/org/apache/lucene/search/TestTermRangeQuery.java@@ -45,13 +45,13 @@ public class TestTermRangeQuery extends LuceneTestCase {private Directory dir;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();dir = newDirectory();}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {dir.close();super.tearDown();}diff --git a/lucene/src/test/org/apache/lucene/search/TestTermScorer.java b/lucene/src/test/org/apache/lucene/search/TestTermScorer.javaindex 28b660ecf46..d3f2d2501c9 100644--- a/lucene/src/test/org/apache/lucene/search/TestTermScorer.java+++ b/lucene/src/test/org/apache/lucene/search/TestTermScorer.java@@ -39,12 +39,8 @@ public class TestTermScorer extends LuceneTestCase {protected IndexSearcher indexSearcher;protected IndexReader indexReader;- public TestTermScorer(String s) {- super(s);- }-@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = newDirectory();@@ -62,7 +58,7 @@ public class TestTermScorer extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {indexSearcher.close();indexReader.close();directory.close();diff --git a/lucene/src/test/org/apache/lucene/search/TestTermVectors.java b/lucene/src/test/org/apache/lucene/search/TestTermVectors.javaindex 01bd500a76c..4abe9d9c90c 100644--- a/lucene/src/test/org/apache/lucene/search/TestTermVectors.java+++ b/lucene/src/test/org/apache/lucene/search/TestTermVectors.java@@ -38,12 +38,8 @@ public class TestTermVectors extends LuceneTestCase {private IndexReader reader;private Directory directory;- public TestTermVectors(String s) {- super(s);- }-@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = newDirectory();RandomIndexWriter writer = new RandomIndexWriter(random, directory, new MockAnalyzer(MockTokenizer.SIMPLE, true));@@ -79,7 +75,7 @@ public class TestTermVectors extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher.close();reader.close();directory.close();diff --git a/lucene/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java b/lucene/src/test/org/apache/lucene/search/TestTimeLimitingCollector.javaindex d81fa939e70..3be1d4e9180 100644--- a/lucene/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java+++ b/lucene/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java@@ -55,15 +55,11 @@ public class TestTimeLimitingCollector extends LuceneTestCase {private final String FIELD_NAME = "body";private Query query;- public TestTimeLimitingCollector(String name) {- super(name);- }-/*** initializes searcher with a document set*/@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();final String docText[] = {"docThatNeverMatchesSoWeCanRequireLastDocCollectedToBeGreaterThanZero",@@ -99,7 +95,7 @@ public class TestTimeLimitingCollector extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher.close();reader.close();directory.close();diff --git a/lucene/src/test/org/apache/lucene/search/TestTopDocsCollector.java b/lucene/src/test/org/apache/lucene/search/TestTopDocsCollector.javaindex d071f256610..348dfc30166 100644--- a/lucene/src/test/org/apache/lucene/search/TestTopDocsCollector.java+++ b/lucene/src/test/org/apache/lucene/search/TestTopDocsCollector.java@@ -102,7 +102,7 @@ public class TestTopDocsCollector extends LuceneTestCase {}@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();// populate an index with 30 documents, this should be enough for the test.@@ -117,7 +117,7 @@ public class TestTopDocsCollector extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {reader.close();dir.close();dir = null;diff --git a/lucene/src/test/org/apache/lucene/search/TestTopScoreDocCollector.java b/lucene/src/test/org/apache/lucene/search/TestTopScoreDocCollector.javaindex bcac185d686..036a211dccd 100644--- a/lucene/src/test/org/apache/lucene/search/TestTopScoreDocCollector.java+++ b/lucene/src/test/org/apache/lucene/search/TestTopScoreDocCollector.java@@ -26,13 +26,6 @@ import org.apache.lucene.util.LuceneTestCase;public class TestTopScoreDocCollector extends LuceneTestCase {- public TestTopScoreDocCollector() {- }-- public TestTopScoreDocCollector(String name) {- super(name);- }-public void testOutOfOrderCollection() throws Exception {Directory dir = newDirectory();RandomIndexWriter writer = new RandomIndexWriter(random, dir);diff --git a/lucene/src/test/org/apache/lucene/search/TestWildcardRandom.java b/lucene/src/test/org/apache/lucene/search/TestWildcardRandom.javaindex 7abaa7f37fe..afad92fe7d8 100644--- a/lucene/src/test/org/apache/lucene/search/TestWildcardRandom.java+++ b/lucene/src/test/org/apache/lucene/search/TestWildcardRandom.java@@ -43,7 +43,7 @@ public class TestWildcardRandom extends LuceneTestCase {private Directory dir;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();dir = newDirectory();RandomIndexWriter writer = new RandomIndexWriter(random, dir,@@ -91,7 +91,7 @@ public class TestWildcardRandom extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher.close();reader.close();dir.close();diff --git a/lucene/src/test/org/apache/lucene/search/function/FunctionTestSetup.java b/lucene/src/test/org/apache/lucene/search/function/FunctionTestSetup.javaindex 85207cc2b45..ddab44bc855 100755--- a/lucene/src/test/org/apache/lucene/search/function/FunctionTestSetup.java+++ b/lucene/src/test/org/apache/lucene/search/function/FunctionTestSetup.java@@ -25,7 +25,7 @@ import org.apache.lucene.document.Fieldable;import org.apache.lucene.index.RandomIndexWriter;import org.apache.lucene.index.IndexWriterConfig;import org.apache.lucene.store.Directory;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util._TestUtil;import org.junit.After;import org.junit.Before;@@ -35,7 +35,7 @@ import org.junit.Ignore;* Setup for function tests*/@Ignore-public class FunctionTestSetup extends LuceneTestCaseJ4 {+public class FunctionTestSetup extends LuceneTestCase {/*** Actual score computation order is slightly different than assumptiosdiff --git a/lucene/src/test/org/apache/lucene/search/function/TestDocValues.java b/lucene/src/test/org/apache/lucene/search/function/TestDocValues.javaindex 64652eb524e..c9eaf5e0f22 100644--- a/lucene/src/test/org/apache/lucene/search/function/TestDocValues.java+++ b/lucene/src/test/org/apache/lucene/search/function/TestDocValues.java@@ -17,7 +17,7 @@ package org.apache.lucene.search.function;* limitations under the License.*/-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.junit.Test;import static org.junit.Assert.assertEquals;import static org.junit.Assert.assertTrue;@@ -25,7 +25,7 @@ import static org.junit.Assert.assertTrue;/*** DocValues TestCase*/-public class TestDocValues extends LuceneTestCaseJ4 {+public class TestDocValues extends LuceneTestCase {@Testpublic void testGetMinValue() {diff --git a/lucene/src/test/org/apache/lucene/search/payloads/PayloadHelper.java b/lucene/src/test/org/apache/lucene/search/payloads/PayloadHelper.javaindex e2c655ed8d8..5714de0ff7c 100644--- a/lucene/src/test/org/apache/lucene/search/payloads/PayloadHelper.java+++ b/lucene/src/test/org/apache/lucene/search/payloads/PayloadHelper.java@@ -33,7 +33,7 @@ import org.apache.lucene.store.Directory;import org.apache.lucene.store.MockDirectoryWrapper;import org.apache.lucene.store.RAMDirectory;-import static org.apache.lucene.util.LuceneTestCaseJ4.TEST_VERSION_CURRENT;+import static org.apache.lucene.util.LuceneTestCase.TEST_VERSION_CURRENT;import java.io.Reader;import java.io.IOException;diff --git a/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java b/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.javaindex dec19afa6c8..62f322f5af8 100644--- a/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java+++ b/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java@@ -54,10 +54,6 @@ public class TestPayloadNearQuery extends LuceneTestCase {private byte[] payload2 = new byte[]{2};private byte[] payload4 = new byte[]{4};- public TestPayloadNearQuery(String s) {- super(s);- }-private class PayloadAnalyzer extends Analyzer {@Overridepublic TokenStream tokenStream(String fieldName, Reader reader) {@@ -104,7 +100,7 @@ public class TestPayloadNearQuery extends LuceneTestCase {}@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = newDirectory();RandomIndexWriter writer = new RandomIndexWriter(random, directory,@@ -126,7 +122,7 @@ public class TestPayloadNearQuery extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher.close();reader.close();directory.close();diff --git a/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java b/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.javaindex ee678f0d66a..b3db12dc9c1 100644--- a/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java+++ b/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java@@ -60,10 +60,6 @@ public class TestPayloadTermQuery extends LuceneTestCase {private byte[] payloadMultiField2 = new byte[]{4};protected Directory directory;- public TestPayloadTermQuery(String s) {- super(s);- }-private class PayloadAnalyzer extends Analyzer {@@ -109,7 +105,7 @@ public class TestPayloadTermQuery extends LuceneTestCase {}@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = newDirectory();RandomIndexWriter writer = new RandomIndexWriter(random, directory,@@ -133,7 +129,7 @@ public class TestPayloadTermQuery extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher.close();reader.close();directory.close();diff --git a/lucene/src/test/org/apache/lucene/search/spans/TestBasics.java b/lucene/src/test/org/apache/lucene/search/spans/TestBasics.javaindex c60907658b1..bcd7bbdb3fd 100644--- a/lucene/src/test/org/apache/lucene/search/spans/TestBasics.java+++ b/lucene/src/test/org/apache/lucene/search/spans/TestBasics.java@@ -38,7 +38,7 @@ import org.apache.lucene.search.QueryUtils;import org.apache.lucene.search.TermQuery;import org.apache.lucene.store.Directory;import org.apache.lucene.util.English;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util._TestUtil;import org.junit.AfterClass;import org.junit.BeforeClass;@@ -58,7 +58,7 @@ import static org.junit.Assert.*;* testing of the indexing and search code.**/-public class TestBasics extends LuceneTestCaseJ4 {+public class TestBasics extends LuceneTestCase {private static IndexSearcher searcher;private static IndexReader reader;private static Directory directory;diff --git a/lucene/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.java b/lucene/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.javaindex 9d491e1551b..74fb68e9aba 100644--- a/lucene/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.java+++ b/lucene/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.java@@ -52,7 +52,7 @@ public class TestFieldMaskingSpanQuery extends LuceneTestCase {protected IndexReader reader;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = newDirectory();RandomIndexWriter writer= new RandomIndexWriter(random, directory);@@ -116,7 +116,7 @@ public class TestFieldMaskingSpanQuery extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher.close();reader.close();directory.close();diff --git a/lucene/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java b/lucene/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.javaindex 5607f8413d7..ba676468e22 100644--- a/lucene/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java+++ b/lucene/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java@@ -43,7 +43,7 @@ public class TestNearSpansOrdered extends LuceneTestCase {new QueryParser(TEST_VERSION_CURRENT, FIELD, new MockAnalyzer());@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher.close();reader.close();directory.close();@@ -51,7 +51,7 @@ public class TestNearSpansOrdered extends LuceneTestCase {}@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = newDirectory();RandomIndexWriter writer= new RandomIndexWriter(random, directory);diff --git a/lucene/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java b/lucene/src/test/org/apache/lucene/search/spans/TestPayloadSpans.javaindex a43c014dc37..a00088c6e5a 100644--- a/lucene/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java+++ b/lucene/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java@@ -55,13 +55,9 @@ public class TestPayloadSpans extends LuceneTestCase {protected IndexReader indexReader;private IndexReader closeIndexReader;private Directory directory;-- public TestPayloadSpans(String s) {- super(s);- }@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();PayloadHelper helper = new PayloadHelper();searcher = helper.setUp(similarity, 1000);diff --git a/lucene/src/test/org/apache/lucene/search/spans/TestSpans.java b/lucene/src/test/org/apache/lucene/search/spans/TestSpans.javaindex cad42ca078b..3bc6d9ce96f 100644--- a/lucene/src/test/org/apache/lucene/search/spans/TestSpans.java+++ b/lucene/src/test/org/apache/lucene/search/spans/TestSpans.java@@ -47,7 +47,7 @@ public class TestSpans extends LuceneTestCase {public static final String field = "field";@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = newDirectory();RandomIndexWriter writer= new RandomIndexWriter(random, directory);@@ -62,7 +62,7 @@ public class TestSpans extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher.close();reader.close();directory.close();diff --git a/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java b/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.javaindex 39d7c62ff81..3481b38bcfa 100644--- a/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java+++ b/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java@@ -52,7 +52,7 @@ public class TestSpansAdvanced extends LuceneTestCase {* Initializes the tests by adding 4 identical documents to the index.*/@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();// create test indexmDirectory = newDirectory();@@ -69,7 +69,7 @@ public class TestSpansAdvanced extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher.close();reader.close();mDirectory.close();diff --git a/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced2.java b/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced2.javaindex 54f7f2d3e35..c5b187abb3b 100644--- a/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced2.java+++ b/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced2.java@@ -41,7 +41,7 @@ public class TestSpansAdvanced2 extends TestSpansAdvanced {* Initializes the tests by adding documents to the index.*/@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();// create test index@@ -61,7 +61,7 @@ public class TestSpansAdvanced2 extends TestSpansAdvanced {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {searcher2.close();reader2.close();super.tearDown();diff --git a/lucene/src/test/org/apache/lucene/store/TestCopyBytes.java b/lucene/src/test/org/apache/lucene/store/TestCopyBytes.javaindex f51c3eda405..4d1654a1a41 100644--- a/lucene/src/test/org/apache/lucene/store/TestCopyBytes.java+++ b/lucene/src/test/org/apache/lucene/store/TestCopyBytes.java@@ -18,13 +18,13 @@ package org.apache.lucene.store;*/-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util._TestUtil;import org.junit.Test;import static org.junit.Assert.*;-public class TestCopyBytes extends LuceneTestCaseJ4 {+public class TestCopyBytes extends LuceneTestCase {private byte value(int idx) {return (byte) ((idx%256) * (1+(idx/256)));diff --git a/lucene/src/test/org/apache/lucene/store/TestMultiMMap.java b/lucene/src/test/org/apache/lucene/store/TestMultiMMap.javaindex 95ceb6ffd0b..fc4d31e6dd3 100644--- a/lucene/src/test/org/apache/lucene/store/TestMultiMMap.java+++ b/lucene/src/test/org/apache/lucene/store/TestMultiMMap.java@@ -38,7 +38,7 @@ public class TestMultiMMap extends LuceneTestCase {File workDir;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();workDir = new File(TEMP_DIR, "TestMultiMMap");workDir.mkdirs();diff --git a/lucene/src/test/org/apache/lucene/store/TestRAMDirectory.java b/lucene/src/test/org/apache/lucene/store/TestRAMDirectory.javaindex 8ad051d1c87..da557c11b3e 100644--- a/lucene/src/test/org/apache/lucene/store/TestRAMDirectory.java+++ b/lucene/src/test/org/apache/lucene/store/TestRAMDirectory.java@@ -47,7 +47,7 @@ public class TestRAMDirectory extends LuceneTestCase {// setup the index@Override- protected void setUp () throws Exception {+ public void setUp() throws Exception {super.setUp();indexDir = new File(TEMP_DIR, "RAMDirIndex");@@ -152,7 +152,7 @@ public class TestRAMDirectory extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {// cleanupif (indexDir != null && indexDir.exists()) {rmDir (indexDir);diff --git a/lucene/src/test/org/apache/lucene/store/TestWindowsMMap.java b/lucene/src/test/org/apache/lucene/store/TestWindowsMMap.javaindex f04ec073ad5..93c1240d3ec 100644--- a/lucene/src/test/org/apache/lucene/store/TestWindowsMMap.java+++ b/lucene/src/test/org/apache/lucene/store/TestWindowsMMap.java@@ -34,7 +34,7 @@ public class TestWindowsMMap extends LuceneTestCase {private final static String alphabet = "abcdefghijklmnopqrstuvwzyz";@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();}diff --git a/lucene/src/test/org/apache/lucene/util/LocalizedTestCase.java b/lucene/src/test/org/apache/lucene/util/LocalizedTestCase.javadeleted file mode 100644index b3ee63f494c..00000000000--- a/lucene/src/test/org/apache/lucene/util/LocalizedTestCase.java+++ /dev/null@@ -1,110 +0,0 @@-package org.apache.lucene.util;--/**- * Licensed to the Apache Software Foundation (ASF) under one or more- * contributor license agreements. See the NOTICE file distributed with- * this work for additional information regarding copyright ownership.- * The ASF licenses this file to You under the Apache License, Version 2.0- * (the "License"); you may not use this file except in compliance with- * the License. You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import java.util.Locale;-import java.util.Set;--/**- * Base test class for Lucene test classes that test Locale-sensitive behavior.- * <p>- * This class will run tests under the default Locale, but then will also run- * tests under all available JVM locales. This is helpful to ensure tests will- * not fail under a different environment.- * </p>- */-public abstract class LocalizedTestCase extends LuceneTestCase {- /**- * Before changing the default Locale, save the default Locale here so that it- * can be restored.- */- private final Locale defaultLocale = Locale.getDefault();-- /**- * The locale being used as the system default Locale- */- private Locale locale;-- /**- * An optional limited set of testcases that will run under different Locales.- */- private final Set<String> testWithDifferentLocales;-- public LocalizedTestCase() {- super();- testWithDifferentLocales = null;- }-- public LocalizedTestCase(String name) {- super(name);- testWithDifferentLocales = null;- }-- public LocalizedTestCase(Set<String> testWithDifferentLocales) {- super();- this.testWithDifferentLocales = testWithDifferentLocales;- }-- public LocalizedTestCase(String name, Set<String> testWithDifferentLocales) {- super(name);- this.testWithDifferentLocales = testWithDifferentLocales;- }-- @Override- protected void setUp() throws Exception {- super.setUp();- Locale.setDefault(locale);- }-- @Override- protected void tearDown() throws Exception {- assertEquals("default locale unexpectedly changed:", locale, Locale- .getDefault());- Locale.setDefault(defaultLocale);- super.tearDown();- }-- @Override- public void runBare() throws Throwable {- // Do the test with the default Locale (default)- try {- locale = defaultLocale;- super.runBare();- } catch (Throwable e) {- System.out.println("Test failure of '" + getName()- + "' occurred with the default Locale " + locale);- throw e;- }-- if (testWithDifferentLocales == null- || testWithDifferentLocales.contains(getName())) {- // Do the test again under different Locales- Locale systemLocales[] = Locale.getAvailableLocales();- for (int i = 0; i < systemLocales.length; i++) {- try {- locale = systemLocales[i];- super.runBare();- } catch (Throwable e) {- System.out.println("Test failure of '" + getName()- + "' occurred under a different Locale " + locale);- throw e;- }- }- }- }-}diff --git a/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java b/lucene/src/test/org/apache/lucene/util/LuceneTestCase.javaindex 653669991b8..d87ced4d0b2 100644--- a/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java+++ b/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java@@ -17,23 +17,6 @@ package org.apache.lucene.util;* limitations under the License.*/-import java.io.File;-import java.io.PrintStream;-import java.io.IOException;-import java.util.Arrays;-import java.util.IdentityHashMap;-import java.util.Iterator;-import java.util.Locale;-import java.util.Map;-import java.util.Random;-import java.util.ArrayList;-import java.util.List;-import java.util.Collections;-import java.util.TimeZone;--import junit.framework.TestCase;-import junit.framework.TestResult;-import org.apache.lucene.analysis.Analyzer;import org.apache.lucene.document.Field;import org.apache.lucene.document.Field.Index;@@ -41,22 +24,65 @@ import org.apache.lucene.document.Field.Store;import org.apache.lucene.document.Field.TermVector;import org.apache.lucene.index.ConcurrentMergeScheduler;import org.apache.lucene.index.IndexWriterConfig;+import org.apache.lucene.index.LogDocMergePolicy;+import org.apache.lucene.index.LogMergePolicy;+import org.apache.lucene.index.SerialMergeScheduler;import org.apache.lucene.index.codecs.Codec;+import org.apache.lucene.index.codecs.CodecProvider;+import org.apache.lucene.index.codecs.mockintblock.MockFixedIntBlockCodec;+import org.apache.lucene.index.codecs.mockintblock.MockVariableIntBlockCodec;+import org.apache.lucene.index.codecs.mocksep.MockSepCodec;+import org.apache.lucene.index.codecs.preflex.PreFlexCodec;+import org.apache.lucene.index.codecs.preflexrw.PreFlexRWCodec;+import org.apache.lucene.index.codecs.pulsing.PulsingCodec;import org.apache.lucene.search.BooleanQuery;import org.apache.lucene.search.FieldCache;import org.apache.lucene.search.FieldCache.CacheEntry;import org.apache.lucene.store.Directory;+import org.apache.lucene.store.MMapDirectory;import org.apache.lucene.store.MockDirectoryWrapper;import org.apache.lucene.util.FieldCacheSanityChecker.Insanity;+import org.junit.After;+import org.junit.AfterClass;+import org.junit.Assert;+import org.junit.Before;+import org.junit.BeforeClass;+import org.junit.Rule;+import org.junit.Test;+import org.junit.rules.TestWatchman;+import org.junit.runner.Description;+import org.junit.runner.RunWith;+import org.junit.runner.manipulation.Filter;+import org.junit.runner.manipulation.NoTestsRemainException;+import org.junit.runner.notification.Failure;+import org.junit.runner.notification.RunListener;+import org.junit.runner.notification.RunNotifier;+import org.junit.runners.BlockJUnit4ClassRunner;+import org.junit.runners.model.FrameworkMethod;+import org.junit.runners.model.InitializationError;-/**- * Base class for all Lucene unit tests.+import java.io.File;+import java.io.IOException;+import java.io.PrintStream;+import java.lang.reflect.Constructor;+import java.lang.reflect.Method;+import java.util.ArrayList;+import java.util.Arrays;+import java.util.Collections;+import java.util.IdentityHashMap;+import java.util.Iterator;+import java.util.List;+import java.util.Locale;+import java.util.Map;+import java.util.Random;+import java.util.TimeZone;+import java.util.WeakHashMap;+import java.util.regex.Matcher;+import java.util.regex.Pattern;++/**+ * Base class for all Lucene unit tests, Junit3 or Junit4 variant.* <p>- * Currently the- * only added functionality over JUnit's TestCase is- * asserting that no unhandled exceptions occurred in- * threads launched by ConcurrentMergeScheduler and asserting sane- * FieldCache usage athe moment of tearDown.* </p>* <p>* If you@@ -65,53 +91,81 @@ import org.apache.lucene.util.FieldCacheSanityChecker.Insanity;* call <code>super.setUp()</code> and* <code>super.tearDown()</code>* </p>- * @see #assertSaneFieldCaches*+ * @After - replaces setup+ * @Before - replaces teardown+ * @Test - any public method with this annotation is a test case, regardless+ * of its name+ * <p>+ * <p>+ * See Junit4 <a href="http://junit.org/junit/javadoc/4.7/">documentation</a> for a complete list of features.+ * <p>+ * Import from org.junit rather than junit.framework.+ * <p>+ * You should be able to use this class anywhere you used LuceneTestCase+ * if you annotate your derived class correctly with the annotations above+ * @see #assertSaneFieldCaches(String)*/-public abstract class LuceneTestCase extends TestCase {++@RunWith(LuceneTestCase.LuceneTestCaseRunner.class)+public abstract class LuceneTestCase extends Assert {/*** true iff tests are run in verbose mode. Note: if it is false, tests are not* expected to print any messages.*/- public static final boolean VERBOSE = LuceneTestCaseJ4.VERBOSE;+ public static final boolean VERBOSE = Boolean.getBoolean("tests.verbose");- /** Use this constant when creating Analyzers and any other version-dependent stuff. */- public static final Version TEST_VERSION_CURRENT = LuceneTestCaseJ4.TEST_VERSION_CURRENT;+ /** Use this constant when creating Analyzers and any other version-dependent stuff.+ * <p><b>NOTE:</b> Change this when development starts for new Lucene version:+ */+ public static final Version TEST_VERSION_CURRENT = Version.LUCENE_40;+ /**+ * If this is set, it is the only method that should run.+ */+ static final String TEST_METHOD;+/** Create indexes in this directory, optimally use a subdir, named after the test */- public static final File TEMP_DIR = LuceneTestCaseJ4.TEMP_DIR;+ public static final File TEMP_DIR;+ static {+ String method = System.getProperty("testmethod", "").trim();+ TEST_METHOD = method.length() == 0 ? null : method;+ String s = System.getProperty("tempDir", System.getProperty("java.io.tmpdir"));+ if (s == null)+ throw new RuntimeException("To run tests, you need to define system property 'tempDir' or 'java.io.tmpdir'.");+ TEMP_DIR = new File(s);+ TEMP_DIR.mkdirs();+ }+ // by default we randomly pick a different codec for+ // each test case (non-J4 tests) and each test class (J4+ // tests)/** Gets the codec to run tests with. */- public static final String TEST_CODEC = LuceneTestCaseJ4.TEST_CODEC;+ static final String TEST_CODEC = System.getProperty("tests.codec", "random");/** Gets the locale to run tests with */- static final String TEST_LOCALE = LuceneTestCaseJ4.TEST_LOCALE;+ static final String TEST_LOCALE = System.getProperty("tests.locale", "random");/** Gets the timezone to run tests with */- static final String TEST_TIMEZONE = LuceneTestCaseJ4.TEST_TIMEZONE;+ static final String TEST_TIMEZONE = System.getProperty("tests.timezone", "random");/** Gets the directory to run tests with */- static final String TEST_DIRECTORY = LuceneTestCaseJ4.TEST_DIRECTORY;+ static final String TEST_DIRECTORY = System.getProperty("tests.directory", "random");+ /** Get the number of times to run tests */+ static final int TEST_ITER = Integer.parseInt(System.getProperty("tests.iter", "1"));/** Get the random seed for tests */- static final String TEST_SEED = LuceneTestCaseJ4.TEST_SEED;+ static final String TEST_SEED = System.getProperty("tests.seed", "random");+ private static final Pattern codecWithParam = Pattern.compile("(.*)\\(\\s*(\\d+)\\s*\\)");+/*** A random multiplier which you should use when writing random tests:* multiply it by the number of iterations*/- public static final int RANDOM_MULTIPLIER = LuceneTestCaseJ4.RANDOM_MULTIPLIER;+ public static final int RANDOM_MULTIPLIER = Integer.parseInt(System.getProperty("tests.multiplier", "1"));private int savedBoolMaxClauseCount;-+private volatile Thread.UncaughtExceptionHandler savedUncaughtExceptionHandler = null;- private Codec codec;-- private Locale locale;- private Locale savedLocale;- private TimeZone timeZone;- private TimeZone savedTimeZone;-- private Map<MockDirectoryWrapper,StackTraceElement[]> stores;-/** Used to track if setUp and tearDown are called correctly from subclasses */private boolean setup;@@ -125,23 +179,160 @@ public abstract class LuceneTestCase extends TestCase {}}private List<UncaughtExceptionEntry> uncaughtExceptions = Collections.synchronizedList(new ArrayList<UncaughtExceptionEntry>());++ // saves default codec: we do this statically as many build indexes in @beforeClass+ private static String savedDefaultCodec;+ private static Codec codec;++ private static Locale locale;+ private static Locale savedLocale;+ private static TimeZone timeZone;+ private static TimeZone savedTimeZone;++ private static Map<MockDirectoryWrapper,StackTraceElement[]> stores;++ private static final String[] TEST_CODECS = new String[] {"MockSep", "MockFixedIntBlock", "MockVariableIntBlock"};++ private static void swapCodec(Codec c) {+ final CodecProvider cp = CodecProvider.getDefault();+ Codec prior = null;+ try {+ prior = cp.lookup(c.name);+ } catch (IllegalArgumentException iae) {+ }+ if (prior != null) {+ cp.unregister(prior);+ }+ cp.register(c);+ }++ // returns current default codec+ static Codec installTestCodecs() {+ final CodecProvider cp = CodecProvider.getDefault();++ savedDefaultCodec = CodecProvider.getDefaultCodec();+ String codec = TEST_CODEC;++ final boolean codecHasParam;+ int codecParam = 0;+ if (codec.equals("random")) {+ codec = pickRandomCodec(seedRnd);+ codecHasParam = false;+ } else {+ Matcher m = codecWithParam.matcher(codec);+ if (m.matches()) {+ // codec has a fixed param+ codecHasParam = true;+ codec = m.group(1);+ codecParam = Integer.parseInt(m.group(2));+ } else {+ codecHasParam = false;+ }+ }++ CodecProvider.setDefaultCodec(codec);++ if (codec.equals("PreFlex")) {+ // If we're running w/ PreFlex codec we must swap in the+ // test-only PreFlexRW codec (since core PreFlex can+ // only read segments):+ swapCodec(new PreFlexRWCodec());+ }- public LuceneTestCase() {- super();+ swapCodec(new MockSepCodec());+ swapCodec(new PulsingCodec(codecHasParam && "Pulsing".equals(codec) ? codecParam : _TestUtil.nextInt(seedRnd, 1, 20)));+ swapCodec(new MockFixedIntBlockCodec(codecHasParam && "MockFixedIntBlock".equals(codec) ? codecParam : _TestUtil.nextInt(seedRnd, 1, 2000)));+ // baseBlockSize cannot be over 127:+ swapCodec(new MockVariableIntBlockCodec(codecHasParam && "MockVariableIntBlock".equals(codec) ? codecParam : _TestUtil.nextInt(seedRnd, 1, 127)));++ return cp.lookup(codec);}- public LuceneTestCase(String name) {- super(name);+ // returns current PreFlex codec+ static void removeTestCodecs(Codec codec) {+ final CodecProvider cp = CodecProvider.getDefault();+ if (codec.name.equals("PreFlex")) {+ final Codec preFlex = cp.lookup("PreFlex");+ if (preFlex != null) {+ cp.unregister(preFlex);+ }+ cp.register(new PreFlexCodec());+ }+ cp.unregister(cp.lookup("MockSep"));+ cp.unregister(cp.lookup("MockFixedIntBlock"));+ cp.unregister(cp.lookup("MockVariableIntBlock"));+ swapCodec(new PulsingCodec(1));+ CodecProvider.setDefaultCodec(savedDefaultCodec);+ }++ // randomly picks from core and test codecs+ static String pickRandomCodec(Random rnd) {+ int idx = rnd.nextInt(CodecProvider.CORE_CODECS.length ++ TEST_CODECS.length);+ if (idx < CodecProvider.CORE_CODECS.length) {+ return CodecProvider.CORE_CODECS[idx];+ } else {+ return TEST_CODECS[idx - CodecProvider.CORE_CODECS.length];+ }+ }++ @BeforeClass+ public static void beforeClassLuceneTestCaseJ4() {+ stores = Collections.synchronizedMap(new IdentityHashMap<MockDirectoryWrapper,StackTraceElement[]>());+ codec = installTestCodecs();+ savedLocale = Locale.getDefault();+ locale = TEST_LOCALE.equals("random") ? randomLocale(seedRnd) : localeForName(TEST_LOCALE);+ Locale.setDefault(locale);+ savedTimeZone = TimeZone.getDefault();+ timeZone = TEST_TIMEZONE.equals("random") ? randomTimeZone(seedRnd) : TimeZone.getTimeZone(TEST_TIMEZONE);+ TimeZone.setDefault(timeZone);+ }++ @AfterClass+ public static void afterClassLuceneTestCaseJ4() {+ removeTestCodecs(codec);+ Locale.setDefault(savedLocale);+ TimeZone.setDefault(savedTimeZone);+ System.clearProperty("solr.solr.home");+ System.clearProperty("solr.data.dir");+ // now look for unclosed resources+ for (MockDirectoryWrapper d : stores.keySet()) {+ if (d.isOpen()) {+ StackTraceElement elements[] = stores.get(d);+ StackTraceElement element = (elements.length > 1) ? elements[1] : null;+ fail("directory of test was not closed, opened from: " + element);+ }+ }+ stores = null;}- @Override- protected void setUp() throws Exception {- super.setUp();- assertFalse("ensure your tearDown() calls super.tearDown()!!!", setup);+ // This is how we get control when errors occur.+ // Think of this as start/end/success/failed+ // events.+ @Rule+ public final TestWatchman intercept = new TestWatchman() {++ @Override+ public void failed(Throwable e, FrameworkMethod method) {+ reportAdditionalFailureInfo();+ super.failed(e, method);+ }++ @Override+ public void starting(FrameworkMethod method) {+ // set current method name for logging+ LuceneTestCase.this.name = method.getName();+ super.starting(method);+ }++ };++ @Before+ public void setUp() throws Exception {+ Assert.assertFalse("ensure your tearDown() calls super.tearDown()!!!", setup);+ setup = true;seed = Long.valueOf(TEST_SEED.equals("random") ? seedRnd.nextLong() : Long.parseLong(TEST_SEED));random = new Random(seed);- setup = true;- stores = new IdentityHashMap<MockDirectoryWrapper,StackTraceElement[]>();savedUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {public void uncaughtException(Thread t, Throwable e) {@@ -153,27 +344,19 @@ public abstract class LuceneTestCase extends TestCase {ConcurrentMergeScheduler.setTestMode();savedBoolMaxClauseCount = BooleanQuery.getMaxClauseCount();- codec = LuceneTestCaseJ4.installTestCodecs();- savedLocale = Locale.getDefault();- locale = TEST_LOCALE.equals("random")- ? LuceneTestCaseJ4.randomLocale(seedRnd)- : LuceneTestCaseJ4.localeForName(TEST_LOCALE);- Locale.setDefault(locale);- savedTimeZone = TimeZone.getDefault();- timeZone = TEST_TIMEZONE.equals("random")- ? LuceneTestCaseJ4.randomTimeZone(seedRnd)- : TimeZone.getTimeZone(TEST_TIMEZONE);- TimeZone.setDefault(timeZone);+ seed = null;}+/*** Forcible purges all cache entries from the FieldCache.* <p>* This method will be called by tearDown to clean up FieldCache.DEFAULT.* If a (poorly written) test has some expectation that the FieldCache- * will persist across test methods (ie: a static IndexReader) this+ * will persist across test methods (ie: a static IndexReader) this* method can be overridden to do nothing.* </p>+ ** @see FieldCache#purgeAllCaches()*/protected void purgeFieldCache(final FieldCache fc) {@@ -184,18 +367,13 @@ public abstract class LuceneTestCase extends TestCase {return getClass().getName() + "." + getName();}- @Override- protected void tearDown() throws Exception {- assertTrue("ensure your setUp() calls super.setUp()!!!", setup);+ @After+ public void tearDown() throws Exception {+ Assert.assertTrue("ensure your setUp() calls super.setUp()!!!", setup);setup = false;BooleanQuery.setMaxClauseCount(savedBoolMaxClauseCount);- LuceneTestCaseJ4.removeTestCodecs(codec);- Locale.setDefault(savedLocale);- TimeZone.setDefault(savedTimeZone);- System.clearProperty("solr.solr.home");- System.clearProperty("solr.data.dir");try {- Thread.setDefaultUncaughtExceptionHandler(savedUncaughtExceptionHandler);+if (!uncaughtExceptions.isEmpty()) {System.err.println("The following exceptions were thrown by threads:");for (UncaughtExceptionEntry entry : uncaughtExceptions) {@@ -205,12 +383,20 @@ public abstract class LuceneTestCase extends TestCase {fail("Some threads threw uncaught exceptions!");}- // this isn't as useful as calling directly from the scope where the- // index readers are used, because they could be gc'ed just before- // tearDown is called.+ // calling assertSaneFieldCaches here isn't as useful as having test+ // classes call it directly from the scope where the index readers+ // are used, because they could be gc'ed just before this tearDown+ // method is called.+ //// But it's better then nothing.+ //+ // If you are testing functionality that you know for a fact+ // "violates" FieldCache sanity, then you should either explicitly+ // call purgeFieldCache at the end of your test method, or refactor+ // your Test class so that the inconsistant FieldCache usages are+ // isolated in distinct test methodsassertSaneFieldCaches(getTestLabel());-+if (ConcurrentMergeScheduler.anyUnhandledExceptions()) {// Clear the failure so that we don't just keep// failing subsequent test cases@@ -220,34 +406,26 @@ public abstract class LuceneTestCase extends TestCase {} finally {purgeFieldCache(FieldCache.DEFAULT);}-- // now look for unclosed resources- for (MockDirectoryWrapper d : stores.keySet()) {- if (d.isOpen()) {- StackTraceElement elements[] = stores.get(d);- StackTraceElement element = (elements.length > 1) ? elements[1] : null;- fail("directory of testcase " + getName() + " was not closed, opened from: " + element);- }- }- stores = null;- super.tearDown();++ Thread.setDefaultUncaughtExceptionHandler(savedUncaughtExceptionHandler);}- /**- * Asserts that FieldCacheSanityChecker does not detect any+ /**+ * Asserts that FieldCacheSanityChecker does not detect any* problems with FieldCache.DEFAULT.* <p>- * If any problems are found, they are logged to System.err+ * If any problems are found, they are logged to System.err* (allong with the msg) when the Assertion is thrown.* </p>* <p>- * This method is called by tearDown after every test method,- * however IndexReaders scoped inside test methods may be garbage- * collected prior to this method being called, causing errors to- * be overlooked. Tests are encouraged to keep their IndexReaders- * scoped at the class level, or to explicitly call this method+ * This method is called by tearDown after every test method,+ * however IndexReaders scoped inside test methods may be garbage+ * collected prior to this method being called, causing errors to+ * be overlooked. Tests are encouraged to keep their IndexReaders+ * scoped at the class level, or to explicitly call this method* directly in the same scope as the IndexReader.* </p>+ ** @see FieldCacheSanityChecker*/protected void assertSaneFieldCaches(final String msg) {@@ -257,12 +435,12 @@ public abstract class LuceneTestCase extends TestCase {try {insanity = FieldCacheSanityChecker.checkSanity(entries);} catch (RuntimeException e) {- dumpArray(msg+ ": FieldCache", entries, System.err);+ dumpArray(msg + ": FieldCache", entries, System.err);throw e;}- assertEquals(msg + ": Insane FieldCache usage(s) found",- 0, insanity.length);+ assertEquals(msg + ": Insane FieldCache usage(s) found",+ 0, insanity.length);insanity = null;} finally {@@ -274,16 +452,39 @@ public abstract class LuceneTestCase extends TestCase {}}++ // These deprecated methods should be removed soon, when all tests using no Epsilon are fixed:++ @Deprecated+ static public void assertEquals(double expected, double actual) {+ assertEquals(null, expected, actual);+ }++ @Deprecated+ static public void assertEquals(String message, double expected, double actual) {+ assertEquals(message, Double.valueOf(expected), Double.valueOf(actual));+ }++ @Deprecated+ static public void assertEquals(float expected, float actual) {+ assertEquals(null, expected, actual);+ }+ @Deprecated+ static public void assertEquals(String message, float expected, float actual) {+ assertEquals(message, Float.valueOf(expected), Float.valueOf(actual));+ }+/*** Convinience method for logging an iterator.- * @param label String logged before/after the items in the iterator- * @param iter Each next() is toString()ed and logged on it's own line. If iter is null this is logged differnetly then an empty iterator.+ *+ * @param label String logged before/after the items in the iterator+ * @param iter Each next() is toString()ed and logged on it's own line. If iter is null this is logged differnetly then an empty iterator.* @param stream Stream to log messages to.*/- public static <T> void dumpIterator(String label, Iterator<T> iter,+ public static void dumpIterator(String label, Iterator<?> iter,PrintStream stream) {- stream.println("*** BEGIN "+label+" ***");+ stream.println("*** BEGIN " + label + " ***");if (null == iter) {stream.println(" ... NULL ...");} else {@@ -291,22 +492,82 @@ public abstract class LuceneTestCase extends TestCase {stream.println(iter.next().toString());}}- stream.println("*** END "+label+" ***");+ stream.println("*** END " + label + " ***");}- /**+ /*** Convinience method for logging an array. Wraps the array in an iterator and delegates+ ** @see #dumpIterator(String,Iterator,PrintStream)*/- public static void dumpArray(String label, Object[] objs,+ public static void dumpArray(String label, Object[] objs,PrintStream stream) {- Iterator<Object> iter = (null == objs) ? null : Arrays.asList(objs).iterator();+ Iterator<?> iter = (null == objs) ? null : Arrays.asList(objs).iterator();dumpIterator(label, iter, stream);}+ private static final Map<Class<? extends LuceneTestCase>,Long> staticSeeds =+ Collections.synchronizedMap(new WeakHashMap<Class<? extends LuceneTestCase>,Long>());++ /**+ * Returns a {@link Random} instance for generating random numbers from a beforeclass+ * annotated method.+ * The random seed is logged during test execution and printed to System.out on any failure+ * for reproducing the test using {@link #newStaticRandom(Class, long)} with the recorded seed+ * .+ */+ public static Random newStaticRandom(Class<? extends LuceneTestCase> clazz) {+ Long seed = seedRnd.nextLong();+ staticSeeds.put(clazz, seed);+ return new Random(seed);+ }++ /**+ * Returns a {@link Random} instance for generating random numbers from a beforeclass+ * annotated method.+ * If an error occurs in the test that is not reproducible, you can use this method to+ * initialize the number generator with the seed that was printed out during the failing test.+ */+ public static Random newStaticRandom(Class<? extends LuceneTestCase> clazz, long seed) {+ staticSeeds.put(clazz, Long.valueOf(seed));+ System.out.println("WARNING: random static seed of testclass '" + clazz + "' is fixed to: " + seed);+ return new Random(seed);+ }+/** create a new index writer config with random defaults */public IndexWriterConfig newIndexWriterConfig(Version v, Analyzer a) {- return LuceneTestCaseJ4.newIndexWriterConfig(random, v, a);+ return newIndexWriterConfig(random, v, a);+ }++ public static IndexWriterConfig newIndexWriterConfig(Random r, Version v, Analyzer a) {+ IndexWriterConfig c = new IndexWriterConfig(v, a);+ if (r.nextBoolean()) {+ c.setMergePolicy(new LogDocMergePolicy());+ }+ if (r.nextBoolean()) {+ c.setMergeScheduler(new SerialMergeScheduler());+ }+ if (r.nextBoolean()) {+ c.setMaxBufferedDocs(_TestUtil.nextInt(r, 2, 1000));+ }+ if (r.nextBoolean()) {+ c.setTermIndexInterval(_TestUtil.nextInt(r, 1, 1000));+ }+ if (r.nextBoolean()) {+ c.setMaxThreadStates(_TestUtil.nextInt(r, 1, 20));+ }++ if (c.getMergePolicy() instanceof LogMergePolicy) {+ LogMergePolicy logmp = (LogMergePolicy) c.getMergePolicy();+ logmp.setUseCompoundDocStore(r.nextBoolean());+ logmp.setUseCompoundFile(r.nextBoolean());+ logmp.setCalibrateSizeByDeletes(r.nextBoolean());+ logmp.setMergeFactor(_TestUtil.nextInt(r, 2, 20));+ }++ c.setReaderPooling(r.nextBoolean());+ c.setReaderTermsIndexDivisor(_TestUtil.nextInt(r, 1, 4));+ return c;}/**@@ -320,8 +581,12 @@ public abstract class LuceneTestCase extends TestCase {* overwritten.*/public MockDirectoryWrapper newDirectory() throws IOException {+ return newDirectory(random);+ }++ public static MockDirectoryWrapper newDirectory(Random r) throws IOException {StackTraceElement[] stack = new Exception().getStackTrace();- Directory impl = LuceneTestCaseJ4.newDirectoryImpl(random, TEST_DIRECTORY);+ Directory impl = newDirectoryImpl(r, TEST_DIRECTORY);MockDirectoryWrapper dir = new MockDirectoryWrapper(impl);stores.put(dir, stack);return dir;@@ -333,8 +598,12 @@ public abstract class LuceneTestCase extends TestCase {* information.*/public MockDirectoryWrapper newDirectory(Directory d) throws IOException {+ return newDirectory(random, d);+ }++ private static MockDirectoryWrapper newDirectory(Random r, Directory d) throws IOException {StackTraceElement[] stack = new Exception().getStackTrace();- Directory impl = LuceneTestCaseJ4.newDirectoryImpl(random, TEST_DIRECTORY);+ Directory impl = newDirectoryImpl(r, TEST_DIRECTORY);for (String file : d.listAll()) {d.copy(impl, file, file);}@@ -344,15 +613,126 @@ public abstract class LuceneTestCase extends TestCase {}public Field newField(String name, String value, Index index) {- return LuceneTestCaseJ4.newField(random, name, value, index);+ return newField(random, name, value, index);}public Field newField(String name, String value, Store store, Index index) {- return LuceneTestCaseJ4.newField(random, name, value, store, index);+ return newField(random, name, value, store, index);}public Field newField(String name, String value, Store store, Index index, TermVector tv) {- return LuceneTestCaseJ4.newField(random, name, value, store, index, tv);+ return newField(random, name, value, store, index, tv);+ }++ public static Field newField(Random random, String name, String value, Index index) {+ return newField(random, name, value, Store.NO, index);+ }++ public static Field newField(Random random, String name, String value, Store store, Index index) {+ return newField(random, name, value, store, index, TermVector.NO);+ }++ public static Field newField(Random random, String name, String value, Store store, Index index, TermVector tv) {+ if (!index.isIndexed())+ return new Field(name, value, store, index);++ if (!store.isStored() && random.nextBoolean())+ store = Store.YES; // randomly store it++ tv = randomTVSetting(random, tv);++ return new Field(name, value, store, index, tv);+ }++ static final TermVector tvSettings[] = {+ TermVector.NO, TermVector.YES, TermVector.WITH_OFFSETS,+ TermVector.WITH_POSITIONS, TermVector.WITH_POSITIONS_OFFSETS+ };++ private static TermVector randomTVSetting(Random random, TermVector minimum) {+ switch(minimum) {+ case NO: return tvSettings[_TestUtil.nextInt(random, 0, tvSettings.length-1)];+ case YES: return tvSettings[_TestUtil.nextInt(random, 1, tvSettings.length-1)];+ case WITH_OFFSETS: return random.nextBoolean() ? TermVector.WITH_OFFSETS+ : TermVector.WITH_POSITIONS_OFFSETS;+ case WITH_POSITIONS: return random.nextBoolean() ? TermVector.WITH_POSITIONS+ : TermVector.WITH_POSITIONS_OFFSETS;+ default: return TermVector.WITH_POSITIONS_OFFSETS;+ }+ }++ /** return a random Locale from the available locales on the system */+ public static Locale randomLocale(Random random) {+ Locale locales[] = Locale.getAvailableLocales();+ return locales[random.nextInt(locales.length)];+ }++ /** return a random TimeZone from the available timezones on the system */+ public static TimeZone randomTimeZone(Random random) {+ String tzIds[] = TimeZone.getAvailableIDs();+ return TimeZone.getTimeZone(tzIds[random.nextInt(tzIds.length)]);+ }++ /** return a Locale object equivalent to its programmatic name */+ public static Locale localeForName(String localeName) {+ String elements[] = localeName.split("\\_");+ switch(elements.length) {+ case 3: return new Locale(elements[0], elements[1], elements[2]);+ case 2: return new Locale(elements[0], elements[1]);+ case 1: return new Locale(elements[0]);+ default: throw new IllegalArgumentException("Invalid Locale: " + localeName);+ }+ }++ private static String CORE_DIRECTORIES[] = {+ "RAMDirectory",+ "SimpleFSDirectory",+ "NIOFSDirectory",+ "MMapDirectory"+ };++ public static String randomDirectory(Random random) {+ if (random.nextInt(10) == 0) {+ return CORE_DIRECTORIES[random.nextInt(CORE_DIRECTORIES.length)];+ } else {+ return "RAMDirectory";+ }+ }++ static Directory newDirectoryImpl(Random random, String clazzName) {+ if (clazzName.equals("random"))+ clazzName = randomDirectory(random);+ if (clazzName.indexOf(".") == -1) // if not fully qualified, assume .store+ clazzName = "org.apache.lucene.store." + clazzName;+ try {+ final Class<? extends Directory> clazz = Class.forName(clazzName).asSubclass(Directory.class);+ try {+ // try empty ctor+ return clazz.newInstance();+ } catch (Exception e) {+ final File tmpFile = File.createTempFile("test", "tmp", TEMP_DIR);+ tmpFile.delete();+ tmpFile.mkdir();+ try {+ Constructor<? extends Directory> ctor = clazz.getConstructor(File.class);+ Directory d = ctor.newInstance(tmpFile);+ // try not to enable this hack unless we must.+ if (d instanceof MMapDirectory && Constants.WINDOWS && MMapDirectory.UNMAP_SUPPORTED)+ ((MMapDirectory)d).setUseUnmap(true);+ return d;+ } catch (Exception e2) {+ // try .open(File)+ Method method = clazz.getMethod("open", new Class[] { File.class });+ return (Directory) method.invoke(null, tmpFile);+ }+ }+ } catch (Exception e) {+ throw new RuntimeException(e);+ }+ }++ public String getName() {+ return this.name;}/** Gets a resource from the classpath as {@link File}. This method should only be used,@@ -366,41 +746,175 @@ public abstract class LuceneTestCase extends TestCase {throw new IOException("Cannot find resource: " + name);}}-- @Override- public void run(TestResult result) {- for (int i = 0; i < LuceneTestCaseJ4.TEST_ITER; i++)- if (LuceneTestCaseJ4.TEST_METHOD == null ||- getName().equals(LuceneTestCaseJ4.TEST_METHOD))- super.run(result);- }-- @Override- public void runBare() throws Throwable {- //long t0 = System.currentTimeMillis();- try {- seed = null;- super.runBare();- } catch (Throwable e) {- System.out.println("NOTE: random codec of testcase '" + getName() + "' was: " + codec);- if (TEST_LOCALE.equals("random"))- System.out.println("NOTE: random locale of testcase '" + getName() + "' was: " + locale);- if (TEST_TIMEZONE.equals("random")) // careful to not deliver NPE here in case they forgot super.setUp- System.out.println("NOTE: random timezone of testcase '" + getName() + "' was: " + (timeZone == null ? "(null)" : timeZone.getID()));- if (seed != null) {- System.out.println("NOTE: random seed of testcase '" + getName() + "' was: " + seed);- }- throw e;+ // We get here from InterceptTestCaseEvents on the 'failed' event....+ public void reportAdditionalFailureInfo() {+ Long staticSeed = staticSeeds.get(getClass());+ if (staticSeed != null) {+ System.out.println("NOTE: random static seed of testclass '" + getName() + "' was: " + staticSeed);+ }++ System.out.println("NOTE: random codec of testcase '" + getName() + "' was: " + codec);+ if (TEST_LOCALE.equals("random"))+ System.out.println("NOTE: random locale of testcase '" + getName() + "' was: " + locale);+ if (TEST_TIMEZONE.equals("random")) // careful to not deliver NPE here in case they forgot super.setUp+ System.out.println("NOTE: random timezone of testcase '" + getName() + "' was: " + (timeZone == null ? "(null)" : timeZone.getID()));+ if (seed != null) {+ System.out.println("NOTE: random seed of testcase '" + getName() + "' was: " + seed);}- //long t = System.currentTimeMillis() - t0;- //System.out.println(t + " msec for " + getName());}-+// recorded seedprotected Long seed = null;protected Random random = null;// static membersprivate static final Random seedRnd = new Random();++ private String name = "<unknown>";++ /** optionally filters the tests to be run by TEST_METHOD */+ public static class LuceneTestCaseRunner extends BlockJUnit4ClassRunner {+ private List<FrameworkMethod> testMethods;++ @Override+ protected List<FrameworkMethod> computeTestMethods() {+ if (testMethods != null)+ return testMethods;+ testMethods = getTestClass().getAnnotatedMethods(Test.class);+ for (Method m : getTestClass().getJavaClass().getMethods())+ if (m.getName().startsWith("test") &&+ m.getAnnotation(Test.class) == null &&+ m.getParameterTypes().length == 0 &&+ m.getGenericReturnType() == Void.TYPE)+ testMethods.add(new FrameworkMethod(m));+ return testMethods;+ }++ @Override+ protected void runChild(FrameworkMethod arg0, RunNotifier arg1) {+ for (int i = 0; i < TEST_ITER; i++)+ super.runChild(arg0, arg1);+ }++ public LuceneTestCaseRunner(Class<?> clazz) throws InitializationError {+ super(clazz);+ Filter f = new Filter() {++ @Override+ public String describe() { return "filters according to TEST_METHOD"; }++ @Override+ public boolean shouldRun(Description d) {+ return TEST_METHOD == null || d.getMethodName().equals(TEST_METHOD);+ }+ };++ try {+ f.apply(this);+ } catch (NoTestsRemainException e) {+ throw new RuntimeException(e);+ }+ }+ }++ /**+ * Test runner for Lucene test classes that test Locale-sensitive behavior.+ * <p>+ * This class will run tests under the default Locale, but then will also run+ * tests under all available JVM locales. This is helpful to ensure tests will+ * not fail under a different environment.+ * </p>+ */+ public static class LocalizedTestCaseRunner extends LuceneTestCaseRunner {+ /**+ * Before changing the default Locale, save the default Locale here so+ * that it can be restored.+ */+ private final Locale defaultLocale = Locale.getDefault();++ /**+ * The locale being used as the system default Locale+ */+ private Locale locale;++ private final RunListener listener = new RunListener() {+ @Override+ public void testFailure(Failure failure) throws Exception {+ super.testFailure(failure);+ String methodName = failure.getDescription().getMethodName();+ if (locale.equals(defaultLocale))+ System.out.println("Test failure of '" + methodName+ + "' occurred with the default Locale " + locale);+ else+ System.out.println("Test failure of '" + methodName+ + "' occurred under a different Locale " + locale);+ }+ };++ public LocalizedTestCaseRunner(Class<?> clazz) throws InitializationError {+ super(clazz);+ }++ @Override+ protected void runChild(FrameworkMethod arg0, RunNotifier arg1) {+ arg1.addListener(listener);+ locale = defaultLocale;+ super.runChild(arg0, arg1);++ for (Locale other : Locale.getAvailableLocales()) {+ locale = other;+ Locale.setDefault(locale);+ super.runChild(arg0, arg1);+ }++ Locale.setDefault(defaultLocale);+ }+ }++ /**+ * Test runner for Lucene test classes that run across all core codecs.+ */+ public static class MultiCodecTestCaseRunner extends LuceneTestCaseRunner {+ /**+ * Before changing the default Codec, save the default Codec here so+ * that it can be restored.+ */+ private final String defaultCodec = CodecProvider.getDefaultCodec();++ /**+ * The Codec being used as the system default+ */+ private String codec;++ private final RunListener listener = new RunListener() {+ @Override+ public void testFailure(Failure failure) throws Exception {+ super.testFailure(failure);+ String methodName = failure.getDescription().getMethodName();+ System.out.println("Test failure of '" + methodName+ + "' occurred with codec " + codec);+ }+ };++ public MultiCodecTestCaseRunner(Class<?> clazz) throws InitializationError {+ super(clazz);+ }++ @Override+ protected void runChild(FrameworkMethod arg0, RunNotifier arg1) {+ arg1.addListener(listener);+ // If we're running w/ PreFlex codec we must swap in the+ // test-only PreFlexRW codec (since core PreFlex can+ // only read segments):+ swapCodec(new PreFlexRWCodec());+ for (String other : CodecProvider.CORE_CODECS) {+ codec = other;+ CodecProvider.setDefaultCodec(codec);+ super.runChild(arg0, arg1);+ }+ CodecProvider.setDefaultCodec(defaultCodec);+ }++ }}diff --git a/lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java b/lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.javadeleted file mode 100644index 20030e84a48..00000000000--- a/lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java+++ /dev/null@@ -1,807 +0,0 @@-package org.apache.lucene.util;--/**- * Licensed to the Apache Software Foundation (ASF) under one or more- * contributor license agreements. See the NOTICE file distributed with- * this work for additional information regarding copyright ownership.- * The ASF licenses this file to You under the Apache License, Version 2.0- * (the "License"); you may not use this file except in compliance with- * the License. You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import org.apache.lucene.analysis.Analyzer;-import org.apache.lucene.document.Field;-import org.apache.lucene.document.Field.Index;-import org.apache.lucene.document.Field.Store;-import org.apache.lucene.document.Field.TermVector;-import org.apache.lucene.index.ConcurrentMergeScheduler;-import org.apache.lucene.index.IndexWriterConfig;-import org.apache.lucene.index.LogDocMergePolicy;-import org.apache.lucene.index.LogMergePolicy;-import org.apache.lucene.index.SerialMergeScheduler;-import org.apache.lucene.index.codecs.Codec;-import org.apache.lucene.index.codecs.CodecProvider;-import org.apache.lucene.index.codecs.mockintblock.MockFixedIntBlockCodec;-import org.apache.lucene.index.codecs.mockintblock.MockVariableIntBlockCodec;-import org.apache.lucene.index.codecs.mocksep.MockSepCodec;-import org.apache.lucene.index.codecs.preflex.PreFlexCodec;-import org.apache.lucene.index.codecs.preflexrw.PreFlexRWCodec;-import org.apache.lucene.index.codecs.pulsing.PulsingCodec;-import org.apache.lucene.search.BooleanQuery;-import org.apache.lucene.search.FieldCache;-import org.apache.lucene.search.FieldCache.CacheEntry;-import org.apache.lucene.store.Directory;-import org.apache.lucene.store.MMapDirectory;-import org.apache.lucene.store.MockDirectoryWrapper;-import org.apache.lucene.util.FieldCacheSanityChecker.Insanity;-import org.junit.After;-import org.junit.AfterClass;-import org.junit.Assert;-import org.junit.Before;-import org.junit.BeforeClass;-import org.junit.Rule;-import org.junit.Test;-import org.junit.rules.TestWatchman;-import org.junit.runner.Description;-import org.junit.runner.RunWith;-import org.junit.runner.manipulation.Filter;-import org.junit.runner.manipulation.NoTestsRemainException;-import org.junit.runner.notification.RunNotifier;-import org.junit.runners.BlockJUnit4ClassRunner;-import org.junit.runners.model.FrameworkMethod;-import org.junit.runners.model.InitializationError;--import java.io.File;-import java.io.IOException;-import java.io.PrintStream;-import java.lang.reflect.Constructor;-import java.lang.reflect.Method;-import java.util.ArrayList;-import java.util.Arrays;-import java.util.Collections;-import java.util.IdentityHashMap;-import java.util.Iterator;-import java.util.List;-import java.util.Locale;-import java.util.Map;-import java.util.Random;-import java.util.TimeZone;-import java.util.WeakHashMap;-import java.util.regex.Matcher;-import java.util.regex.Pattern;--import static org.junit.Assert.assertEquals;-import static org.junit.Assert.fail;--/**- * Base class for all Lucene unit tests, Junit4 variant.- * Replaces LuceneTestCase.- * <p>- * </p>- * <p>- * If you- * override either <code>setUp()</code> or- * <code>tearDown()</code> in your unit test, make sure you- * call <code>super.setUp()</code> and- * <code>super.tearDown()</code>- * </p>- *- * @After - replaces setup- * @Before - replaces teardown- * @Test - any public method with this annotation is a test case, regardless- * of its name- * <p>- * <p>- * See Junit4 <a href="http://junit.org/junit/javadoc/4.7/">documentation</a> for a complete list of features.- * <p>- * Import from org.junit rather than junit.framework.- * <p>- * You should be able to use this class anywhere you used LuceneTestCase- * if you annotate your derived class correctly with the annotations above- * @see #assertSaneFieldCaches(String)- */---// If we really need functionality in runBare override from LuceneTestCase,-// we can introduce RunBareWrapper and override runChild, and add the-// @RunWith annotation as below. runChild will be called for-// every test. But the functionality we used to-// get from that override is provided by InterceptTestCaseEvents-//@RunWith(RunBareWrapper.class)-@RunWith(LuceneTestCaseJ4.LuceneTestCaseRunner.class)-public abstract class LuceneTestCaseJ4 {-- /**- * true iff tests are run in verbose mode. Note: if it is false, tests are not- * expected to print any messages.- */- public static final boolean VERBOSE = Boolean.getBoolean("tests.verbose");-- /** Use this constant when creating Analyzers and any other version-dependent stuff.- * <p><b>NOTE:</b> Change this when development starts for new Lucene version:- */- public static final Version TEST_VERSION_CURRENT = Version.LUCENE_40;-- /**- * If this is set, it is the only method that should run.- */- static final String TEST_METHOD;-- /** Create indexes in this directory, optimally use a subdir, named after the test */- public static final File TEMP_DIR;- static {- String method = System.getProperty("testmethod", "").trim();- TEST_METHOD = method.length() == 0 ? null : method;- String s = System.getProperty("tempDir", System.getProperty("java.io.tmpdir"));- if (s == null)- throw new RuntimeException("To run tests, you need to define system property 'tempDir' or 'java.io.tmpdir'.");- TEMP_DIR = new File(s);- TEMP_DIR.mkdirs();- }-- // by default we randomly pick a different codec for- // each test case (non-J4 tests) and each test class (J4- // tests)- /** Gets the codec to run tests with. */- static final String TEST_CODEC = System.getProperty("tests.codec", "random");- /** Gets the locale to run tests with */- static final String TEST_LOCALE = System.getProperty("tests.locale", "random");- /** Gets the timezone to run tests with */- static final String TEST_TIMEZONE = System.getProperty("tests.timezone", "random");- /** Gets the directory to run tests with */- static final String TEST_DIRECTORY = System.getProperty("tests.directory", "random");- /** Get the number of times to run tests */- static final int TEST_ITER = Integer.parseInt(System.getProperty("tests.iter", "1"));- /** Get the random seed for tests */- static final String TEST_SEED = System.getProperty("tests.seed", "random");-- private static final Pattern codecWithParam = Pattern.compile("(.*)\\(\\s*(\\d+)\\s*\\)");-- /**- * A random multiplier which you should use when writing random tests:- * multiply it by the number of iterations- */- public static final int RANDOM_MULTIPLIER = Integer.parseInt(System.getProperty("tests.multiplier", "1"));-- private int savedBoolMaxClauseCount;-- private volatile Thread.UncaughtExceptionHandler savedUncaughtExceptionHandler = null;-- /** Used to track if setUp and tearDown are called correctly from subclasses */- private boolean setup;-- private static class UncaughtExceptionEntry {- public final Thread thread;- public final Throwable exception;-- public UncaughtExceptionEntry(Thread thread, Throwable exception) {- this.thread = thread;- this.exception = exception;- }- }- private List<UncaughtExceptionEntry> uncaughtExceptions = Collections.synchronizedList(new ArrayList<UncaughtExceptionEntry>());-- // checks if class correctly annotated- private static final Object PLACEHOLDER = new Object();- private static final Map<Class<? extends LuceneTestCaseJ4>,Object> checkedClasses =- Collections.synchronizedMap(new WeakHashMap<Class<? extends LuceneTestCaseJ4>,Object>());-- // saves default codec: we do this statically as many build indexes in @beforeClass- private static String savedDefaultCodec;- private static Codec codec;-- private static Locale locale;- private static Locale savedLocale;- private static TimeZone timeZone;- private static TimeZone savedTimeZone;-- private static Map<MockDirectoryWrapper,StackTraceElement[]> stores;-- private static final String[] TEST_CODECS = new String[] {"MockSep", "MockFixedIntBlock", "MockVariableIntBlock"};-- private static void swapCodec(Codec c) {- final CodecProvider cp = CodecProvider.getDefault();- Codec prior = null;- try {- prior = cp.lookup(c.name);- } catch (IllegalArgumentException iae) {- }- if (prior != null) {- cp.unregister(prior);- }- cp.register(c);- }-- // returns current default codec- static Codec installTestCodecs() {- final CodecProvider cp = CodecProvider.getDefault();-- savedDefaultCodec = CodecProvider.getDefaultCodec();- String codec = TEST_CODEC;-- final boolean codecHasParam;- int codecParam = 0;- if (codec.equals("random")) {- codec = pickRandomCodec(seedRnd);- codecHasParam = false;- } else {- Matcher m = codecWithParam.matcher(codec);- if (m.matches()) {- // codec has a fixed param- codecHasParam = true;- codec = m.group(1);- codecParam = Integer.parseInt(m.group(2));- } else {- codecHasParam = false;- }- }-- CodecProvider.setDefaultCodec(codec);-- if (codec.equals("PreFlex")) {- // If we're running w/ PreFlex codec we must swap in the- // test-only PreFlexRW codec (since core PreFlex can- // only read segments):- swapCodec(new PreFlexRWCodec());- }-- swapCodec(new MockSepCodec());- swapCodec(new PulsingCodec(codecHasParam && "Pulsing".equals(codec) ? codecParam : _TestUtil.nextInt(seedRnd, 1, 20)));- swapCodec(new MockFixedIntBlockCodec(codecHasParam && "MockFixedIntBlock".equals(codec) ? codecParam : _TestUtil.nextInt(seedRnd, 1, 2000)));- // baseBlockSize cannot be over 127:- swapCodec(new MockVariableIntBlockCodec(codecHasParam && "MockVariableIntBlock".equals(codec) ? codecParam : _TestUtil.nextInt(seedRnd, 1, 127)));-- return cp.lookup(codec);- }-- // returns current PreFlex codec- static void removeTestCodecs(Codec codec) {- final CodecProvider cp = CodecProvider.getDefault();- if (codec.name.equals("PreFlex")) {- final Codec preFlex = cp.lookup("PreFlex");- if (preFlex != null) {- cp.unregister(preFlex);- }- cp.register(new PreFlexCodec());- }- cp.unregister(cp.lookup("MockSep"));- cp.unregister(cp.lookup("MockFixedIntBlock"));- cp.unregister(cp.lookup("MockVariableIntBlock"));- swapCodec(new PulsingCodec(1));- CodecProvider.setDefaultCodec(savedDefaultCodec);- }-- // randomly picks from core and test codecs- static String pickRandomCodec(Random rnd) {- int idx = rnd.nextInt(CodecProvider.CORE_CODECS.length +- TEST_CODECS.length);- if (idx < CodecProvider.CORE_CODECS.length) {- return CodecProvider.CORE_CODECS[idx];- } else {- return TEST_CODECS[idx - CodecProvider.CORE_CODECS.length];- }- }-- @BeforeClass- public static void beforeClassLuceneTestCaseJ4() {- stores = Collections.synchronizedMap(new IdentityHashMap<MockDirectoryWrapper,StackTraceElement[]>());- codec = installTestCodecs();- savedLocale = Locale.getDefault();- locale = TEST_LOCALE.equals("random") ? randomLocale(seedRnd) : localeForName(TEST_LOCALE);- Locale.setDefault(locale);- savedTimeZone = TimeZone.getDefault();- timeZone = TEST_TIMEZONE.equals("random") ? randomTimeZone(seedRnd) : TimeZone.getTimeZone(TEST_TIMEZONE);- TimeZone.setDefault(timeZone);- }-- @AfterClass- public static void afterClassLuceneTestCaseJ4() {- removeTestCodecs(codec);- Locale.setDefault(savedLocale);- TimeZone.setDefault(savedTimeZone);- System.clearProperty("solr.solr.home");- System.clearProperty("solr.data.dir");- // now look for unclosed resources- for (MockDirectoryWrapper d : stores.keySet()) {- if (d.isOpen()) {- StackTraceElement elements[] = stores.get(d);- StackTraceElement element = (elements.length > 1) ? elements[1] : null;- fail("directory of test was not closed, opened from: " + element);- }- }- stores = null;- }-- // This is how we get control when errors occur.- // Think of this as start/end/success/failed- // events.- @Rule- public final TestWatchman intercept = new TestWatchman() {-- @Override- public void failed(Throwable e, FrameworkMethod method) {- reportAdditionalFailureInfo();- super.failed(e, method);- }-- @Override- public void starting(FrameworkMethod method) {- // set current method name for logging- LuceneTestCaseJ4.this.name = method.getName();- // check if the current test's class annotated all test* methods with @Test- final Class<? extends LuceneTestCaseJ4> clazz = LuceneTestCaseJ4.this.getClass();- if (!checkedClasses.containsKey(clazz)) {- checkedClasses.put(clazz, PLACEHOLDER);- for (Method m : clazz.getMethods()) {- if (m.getName().startsWith("test") && m.getAnnotation(Test.class) == null) {- fail("In class '" + clazz.getName() + "' the method '" + m.getName() + "' is not annotated with @Test.");- }- }- }- super.starting(method);- }-- };-- @Before- public void setUp() throws Exception {- Assert.assertFalse("ensure your tearDown() calls super.tearDown()!!!", setup);- setup = true;- seed = Long.valueOf(TEST_SEED.equals("random") ? seedRnd.nextLong() : Long.parseLong(TEST_SEED));- random = new Random(seed);- savedUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();- Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {- public void uncaughtException(Thread t, Throwable e) {- uncaughtExceptions.add(new UncaughtExceptionEntry(t, e));- if (savedUncaughtExceptionHandler != null)- savedUncaughtExceptionHandler.uncaughtException(t, e);- }- });-- ConcurrentMergeScheduler.setTestMode();- savedBoolMaxClauseCount = BooleanQuery.getMaxClauseCount();- seed = null;- }--- /**- * Forcible purges all cache entries from the FieldCache.- * <p>- * This method will be called by tearDown to clean up FieldCache.DEFAULT.- * If a (poorly written) test has some expectation that the FieldCache- * will persist across test methods (ie: a static IndexReader) this- * method can be overridden to do nothing.- * </p>- *- * @see FieldCache#purgeAllCaches()- */- protected void purgeFieldCache(final FieldCache fc) {- fc.purgeAllCaches();- }-- protected String getTestLabel() {- return getClass().getName() + "." + getName();- }-- @After- public void tearDown() throws Exception {- Assert.assertTrue("ensure your setUp() calls super.setUp()!!!", setup);- setup = false;- BooleanQuery.setMaxClauseCount(savedBoolMaxClauseCount);- try {-- if (!uncaughtExceptions.isEmpty()) {- System.err.println("The following exceptions were thrown by threads:");- for (UncaughtExceptionEntry entry : uncaughtExceptions) {- System.err.println("*** Thread: " + entry.thread.getName() + " ***");- entry.exception.printStackTrace(System.err);- }- fail("Some threads threw uncaught exceptions!");- }-- // calling assertSaneFieldCaches here isn't as useful as having test- // classes call it directly from the scope where the index readers- // are used, because they could be gc'ed just before this tearDown- // method is called.- //- // But it's better then nothing.- //- // If you are testing functionality that you know for a fact- // "violates" FieldCache sanity, then you should either explicitly- // call purgeFieldCache at the end of your test method, or refactor- // your Test class so that the inconsistant FieldCache usages are- // isolated in distinct test methods- assertSaneFieldCaches(getTestLabel());-- if (ConcurrentMergeScheduler.anyUnhandledExceptions()) {- // Clear the failure so that we don't just keep- // failing subsequent test cases- ConcurrentMergeScheduler.clearUnhandledExceptions();- fail("ConcurrentMergeScheduler hit unhandled exceptions");- }- } finally {- purgeFieldCache(FieldCache.DEFAULT);- }-- Thread.setDefaultUncaughtExceptionHandler(savedUncaughtExceptionHandler);- }-- /**- * Asserts that FieldCacheSanityChecker does not detect any- * problems with FieldCache.DEFAULT.- * <p>- * If any problems are found, they are logged to System.err- * (allong with the msg) when the Assertion is thrown.- * </p>- * <p>- * This method is called by tearDown after every test method,- * however IndexReaders scoped inside test methods may be garbage- * collected prior to this method being called, causing errors to- * be overlooked. Tests are encouraged to keep their IndexReaders- * scoped at the class level, or to explicitly call this method- * directly in the same scope as the IndexReader.- * </p>- *- * @see FieldCacheSanityChecker- */- protected void assertSaneFieldCaches(final String msg) {- final CacheEntry[] entries = FieldCache.DEFAULT.getCacheEntries();- Insanity[] insanity = null;- try {- try {- insanity = FieldCacheSanityChecker.checkSanity(entries);- } catch (RuntimeException e) {- dumpArray(msg + ": FieldCache", entries, System.err);- throw e;- }-- assertEquals(msg + ": Insane FieldCache usage(s) found",- 0, insanity.length);- insanity = null;- } finally {-- // report this in the event of any exception/failure- // if no failure, then insanity will be null anyway- if (null != insanity) {- dumpArray(msg + ": Insane FieldCache usage(s)", insanity, System.err);- }-- }- }-- /**- * Convinience method for logging an iterator.- *- * @param label String logged before/after the items in the iterator- * @param iter Each next() is toString()ed and logged on it's own line. If iter is null this is logged differnetly then an empty iterator.- * @param stream Stream to log messages to.- */- public static void dumpIterator(String label, Iterator<?> iter,- PrintStream stream) {- stream.println("*** BEGIN " + label + " ***");- if (null == iter) {- stream.println(" ... NULL ...");- } else {- while (iter.hasNext()) {- stream.println(iter.next().toString());- }- }- stream.println("*** END " + label + " ***");- }-- /**- * Convinience method for logging an array. Wraps the array in an iterator and delegates- *- * @see #dumpIterator(String,Iterator,PrintStream)- */- public static void dumpArray(String label, Object[] objs,- PrintStream stream) {- Iterator<?> iter = (null == objs) ? null : Arrays.asList(objs).iterator();- dumpIterator(label, iter, stream);- }-- private static final Map<Class<? extends LuceneTestCaseJ4>,Long> staticSeeds =- Collections.synchronizedMap(new WeakHashMap<Class<? extends LuceneTestCaseJ4>,Long>());-- /**- * Returns a {@link Random} instance for generating random numbers from a beforeclass- * annotated method.- * The random seed is logged during test execution and printed to System.out on any failure- * for reproducing the test using {@link #newStaticRandom(Class, long)} with the recorded seed- * .- */- public static Random newStaticRandom(Class<? extends LuceneTestCaseJ4> clazz) {- Long seed = seedRnd.nextLong();- staticSeeds.put(clazz, seed);- return new Random(seed);- }-- /**- * Returns a {@link Random} instance for generating random numbers from a beforeclass- * annotated method.- * If an error occurs in the test that is not reproducible, you can use this method to- * initialize the number generator with the seed that was printed out during the failing test.- */- public static Random newStaticRandom(Class<? extends LuceneTestCaseJ4> clazz, long seed) {- staticSeeds.put(clazz, Long.valueOf(seed));- System.out.println("WARNING: random static seed of testclass '" + clazz + "' is fixed to: " + seed);- return new Random(seed);- }-- /** create a new index writer config with random defaults */- public IndexWriterConfig newIndexWriterConfig(Version v, Analyzer a) {- return newIndexWriterConfig(random, v, a);- }-- public static IndexWriterConfig newIndexWriterConfig(Random r, Version v, Analyzer a) {- IndexWriterConfig c = new IndexWriterConfig(v, a);- if (r.nextBoolean()) {- c.setMergePolicy(new LogDocMergePolicy());- }- if (r.nextBoolean()) {- c.setMergeScheduler(new SerialMergeScheduler());- }- if (r.nextBoolean()) {- c.setMaxBufferedDocs(_TestUtil.nextInt(r, 2, 1000));- }- if (r.nextBoolean()) {- c.setTermIndexInterval(_TestUtil.nextInt(r, 1, 1000));- }- if (r.nextBoolean()) {- c.setMaxThreadStates(_TestUtil.nextInt(r, 1, 20));- }-- if (c.getMergePolicy() instanceof LogMergePolicy) {- LogMergePolicy logmp = (LogMergePolicy) c.getMergePolicy();- logmp.setUseCompoundDocStore(r.nextBoolean());- logmp.setUseCompoundFile(r.nextBoolean());- logmp.setCalibrateSizeByDeletes(r.nextBoolean());- logmp.setMergeFactor(_TestUtil.nextInt(r, 2, 20));- }-- c.setReaderPooling(r.nextBoolean());- c.setReaderTermsIndexDivisor(_TestUtil.nextInt(r, 1, 4));- return c;- }-- /**- * Returns a new Dictionary instance. Use this when the test does not- * care about the specific Directory implementation (most tests).- * <p>- * The Directory is wrapped with {@link MockDirectoryWrapper}.- * By default this means it will be picky, such as ensuring that you- * properly close it and all open files in your test. It will emulate- * some features of Windows, such as not allowing open files to be- * overwritten.- */- public MockDirectoryWrapper newDirectory() throws IOException {- return newDirectory(random);- }-- public static MockDirectoryWrapper newDirectory(Random r) throws IOException {- StackTraceElement[] stack = new Exception().getStackTrace();- Directory impl = newDirectoryImpl(r, TEST_DIRECTORY);- MockDirectoryWrapper dir = new MockDirectoryWrapper(impl);- stores.put(dir, stack);- return dir;- }-- /**- * Returns a new Dictionary instance, with contents copied from the- * provided directory. See {@link #newDirectory()} for more- * information.- */- public MockDirectoryWrapper newDirectory(Directory d) throws IOException {- return newDirectory(random, d);- }-- private static MockDirectoryWrapper newDirectory(Random r, Directory d) throws IOException {- StackTraceElement[] stack = new Exception().getStackTrace();- Directory impl = newDirectoryImpl(r, TEST_DIRECTORY);- for (String file : d.listAll()) {- d.copy(impl, file, file);- }- MockDirectoryWrapper dir = new MockDirectoryWrapper(impl);- stores.put(dir, stack);- return dir;- }-- public Field newField(String name, String value, Index index) {- return newField(random, name, value, index);- }-- public Field newField(String name, String value, Store store, Index index) {- return newField(random, name, value, store, index);- }-- public Field newField(String name, String value, Store store, Index index, TermVector tv) {- return newField(random, name, value, store, index, tv);- }-- public static Field newField(Random random, String name, String value, Index index) {- return newField(random, name, value, Store.NO, index);- }-- public static Field newField(Random random, String name, String value, Store store, Index index) {- return newField(random, name, value, store, index, TermVector.NO);- }-- public static Field newField(Random random, String name, String value, Store store, Index index, TermVector tv) {- if (!index.isIndexed())- return new Field(name, value, store, index);-- if (!store.isStored() && random.nextBoolean())- store = Store.YES; // randomly store it-- tv = randomTVSetting(random, tv);-- return new Field(name, value, store, index, tv);- }-- static final TermVector tvSettings[] = {- TermVector.NO, TermVector.YES, TermVector.WITH_OFFSETS,- TermVector.WITH_POSITIONS, TermVector.WITH_POSITIONS_OFFSETS- };-- private static TermVector randomTVSetting(Random random, TermVector minimum) {- switch(minimum) {- case NO: return tvSettings[_TestUtil.nextInt(random, 0, tvSettings.length-1)];- case YES: return tvSettings[_TestUtil.nextInt(random, 1, tvSettings.length-1)];- case WITH_OFFSETS: return random.nextBoolean() ? TermVector.WITH_OFFSETS- : TermVector.WITH_POSITIONS_OFFSETS;- case WITH_POSITIONS: return random.nextBoolean() ? TermVector.WITH_POSITIONS- : TermVector.WITH_POSITIONS_OFFSETS;- default: return TermVector.WITH_POSITIONS_OFFSETS;- }- }-- /** return a random Locale from the available locales on the system */- public static Locale randomLocale(Random random) {- Locale locales[] = Locale.getAvailableLocales();- return locales[random.nextInt(locales.length)];- }-- /** return a random TimeZone from the available timezones on the system */- public static TimeZone randomTimeZone(Random random) {- String tzIds[] = TimeZone.getAvailableIDs();- return TimeZone.getTimeZone(tzIds[random.nextInt(tzIds.length)]);- }-- /** return a Locale object equivalent to its programmatic name */- public static Locale localeForName(String localeName) {- String elements[] = localeName.split("\\_");- switch(elements.length) {- case 3: return new Locale(elements[0], elements[1], elements[2]);- case 2: return new Locale(elements[0], elements[1]);- case 1: return new Locale(elements[0]);- default: throw new IllegalArgumentException("Invalid Locale: " + localeName);- }- }-- private static String CORE_DIRECTORIES[] = {- "RAMDirectory",- "SimpleFSDirectory",- "NIOFSDirectory",- "MMapDirectory"- };-- public static String randomDirectory(Random random) {- if (random.nextInt(10) == 0) {- return CORE_DIRECTORIES[random.nextInt(CORE_DIRECTORIES.length)];- } else {- return "RAMDirectory";- }- }-- static Directory newDirectoryImpl(Random random, String clazzName) {- if (clazzName.equals("random"))- clazzName = randomDirectory(random);- if (clazzName.indexOf(".") == -1) // if not fully qualified, assume .store- clazzName = "org.apache.lucene.store." + clazzName;- try {- final Class<? extends Directory> clazz = Class.forName(clazzName).asSubclass(Directory.class);- try {- // try empty ctor- return clazz.newInstance();- } catch (Exception e) {- final File tmpFile = File.createTempFile("test", "tmp", TEMP_DIR);- tmpFile.delete();- tmpFile.mkdir();- try {- Constructor<? extends Directory> ctor = clazz.getConstructor(File.class);- Directory d = ctor.newInstance(tmpFile);- // try not to enable this hack unless we must.- if (d instanceof MMapDirectory && Constants.WINDOWS && MMapDirectory.UNMAP_SUPPORTED)- ((MMapDirectory)d).setUseUnmap(true);- return d;- } catch (Exception e2) {- // try .open(File)- Method method = clazz.getMethod("open", new Class[] { File.class });- return (Directory) method.invoke(null, tmpFile);- }- }- } catch (Exception e) {- throw new RuntimeException(e);- }- }-- public String getName() {- return this.name;- }-- /** Gets a resource from the classpath as {@link File}. This method should only be used,- * if a real file is needed. To get a stream, code should prefer- * {@link Class#getResourceAsStream} using {@code this.getClass()}.- */- protected File getDataFile(String name) throws IOException {- try {- return new File(this.getClass().getResource(name).toURI());- } catch (Exception e) {- throw new IOException("Cannot find resource: " + name);- }- }-- // We get here from InterceptTestCaseEvents on the 'failed' event....- public void reportAdditionalFailureInfo() {- Long staticSeed = staticSeeds.get(getClass());- if (staticSeed != null) {- System.out.println("NOTE: random static seed of testclass '" + getName() + "' was: " + staticSeed);- }-- System.out.println("NOTE: random codec of testcase '" + getName() + "' was: " + codec);- if (TEST_LOCALE.equals("random"))- System.out.println("NOTE: random locale of testcase '" + getName() + "' was: " + locale);- if (TEST_TIMEZONE.equals("random")) // careful to not deliver NPE here in case they forgot super.setUp- System.out.println("NOTE: random timezone of testcase '" + getName() + "' was: " + (timeZone == null ? "(null)" : timeZone.getID()));- if (seed != null) {- System.out.println("NOTE: random seed of testcase '" + getName() + "' was: " + seed);- }- }-- // recorded seed- protected Long seed = null;- protected Random random = null;-- // static members- private static final Random seedRnd = new Random();-- private String name = "<unknown>";-- /** optionally filters the tests to be run by TEST_METHOD */- public static class LuceneTestCaseRunner extends BlockJUnit4ClassRunner {-- @Override- protected void runChild(FrameworkMethod arg0, RunNotifier arg1) {- for (int i = 0; i < TEST_ITER; i++)- super.runChild(arg0, arg1);- }-- public LuceneTestCaseRunner(Class<?> clazz) throws InitializationError {- super(clazz);- Filter f = new Filter() {-- @Override- public String describe() { return "filters according to TEST_METHOD"; }-- @Override- public boolean shouldRun(Description d) {- return TEST_METHOD == null || d.getMethodName().equals(TEST_METHOD);- }- };-- try {- f.apply(this);- } catch (NoTestsRemainException e) {- throw new RuntimeException(e);- }- }- }-}diff --git a/lucene/src/test/org/apache/lucene/util/MultiCodecTestCase.java b/lucene/src/test/org/apache/lucene/util/MultiCodecTestCase.javadeleted file mode 100644index a799f36d64a..00000000000--- a/lucene/src/test/org/apache/lucene/util/MultiCodecTestCase.java+++ /dev/null@@ -1,46 +0,0 @@-package org.apache.lucene.util;--/**- * Licensed to the Apache Software Foundation (ASF) under one or more- * contributor license agreements. See the NOTICE file distributed with- * this work for additional information regarding copyright ownership.- * The ASF licenses this file to You under the Apache License, Version 2.0- * (the "License"); you may not use this file except in compliance with- * the License. You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import org.apache.lucene.index.codecs.CodecProvider;--/**- * Base test class for Lucene test classes that to test across- * all core codecs.- */-public abstract class MultiCodecTestCase extends LuceneTestCase {-- @Override- public void runBare() throws Throwable {- final String savedDefaultCodec = CodecProvider.getDefaultCodec();- try {- for(String codec : CodecProvider.CORE_CODECS) {- CodecProvider.setDefaultCodec(codec);- try {- super.runBare();- } catch (Throwable e) {- System.out.println("Test failure of '" + getName()- + "' occurred with \"" + codec + "\" codec");- throw e;- }- }- } finally {- CodecProvider.setDefaultCodec(savedDefaultCodec);- }- }-}diff --git a/lucene/src/test/org/apache/lucene/util/TestBitVector.java b/lucene/src/test/org/apache/lucene/util/TestBitVector.javaindex 3516ed87395..a0203d0a9ee 100644--- a/lucene/src/test/org/apache/lucene/util/TestBitVector.java+++ b/lucene/src/test/org/apache/lucene/util/TestBitVector.java@@ -28,9 +28,6 @@ import org.apache.lucene.store.RAMDirectory;*/public class TestBitVector extends LuceneTestCase{- public TestBitVector(String s) {- super(s);- }/*** Test the default constructor on BitVectors of various sizes.diff --git a/lucene/src/test/org/apache/lucene/util/TestCharacterUtils.java b/lucene/src/test/org/apache/lucene/util/TestCharacterUtils.javaindex 4618848450f..cb6789c1d3b 100644--- a/lucene/src/test/org/apache/lucene/util/TestCharacterUtils.java+++ b/lucene/src/test/org/apache/lucene/util/TestCharacterUtils.java@@ -18,7 +18,7 @@ package org.apache.lucene.util;*/import static org.junit.Assert.*;-import static org.apache.lucene.util.LuceneTestCaseJ4.TEST_VERSION_CURRENT;+import static org.apache.lucene.util.LuceneTestCase.TEST_VERSION_CURRENT;import java.io.IOException;import java.io.Reader;diff --git a/lucene/src/test/org/apache/lucene/util/TestFieldCacheSanityChecker.java b/lucene/src/test/org/apache/lucene/util/TestFieldCacheSanityChecker.javaindex f34ae203f65..00181391a0e 100644--- a/lucene/src/test/org/apache/lucene/util/TestFieldCacheSanityChecker.java+++ b/lucene/src/test/org/apache/lucene/util/TestFieldCacheSanityChecker.java@@ -38,7 +38,7 @@ public class TestFieldCacheSanityChecker extends LuceneTestCase {private static final int NUM_DOCS = 1000;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();dirA = newDirectory();dirB = newDirectory();@@ -74,7 +74,7 @@ public class TestFieldCacheSanityChecker extends LuceneTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {readerA.close();readerB.close();readerX.close();diff --git a/lucene/src/test/org/apache/lucene/util/TestPriorityQueue.java b/lucene/src/test/org/apache/lucene/util/TestPriorityQueue.javaindex dc296a16a45..52f704e0e58 100644--- a/lucene/src/test/org/apache/lucene/util/TestPriorityQueue.java+++ b/lucene/src/test/org/apache/lucene/util/TestPriorityQueue.java@@ -20,9 +20,6 @@ package org.apache.lucene.util;import java.util.Random;public class TestPriorityQueue extends LuceneTestCase {- public TestPriorityQueue(String name) {- super(name);- }private static class IntegerQueue extends PriorityQueue<Integer> {public IntegerQueue(int count) {diff --git a/lucene/src/test/org/apache/lucene/util/TestSetOnce.java b/lucene/src/test/org/apache/lucene/util/TestSetOnce.javaindex 28c43ebcebe..05af1806ab0 100644--- a/lucene/src/test/org/apache/lucene/util/TestSetOnce.java+++ b/lucene/src/test/org/apache/lucene/util/TestSetOnce.java@@ -24,7 +24,7 @@ import java.util.Random;import org.apache.lucene.util.SetOnce.AlreadySetException;import org.junit.Test;-public class TestSetOnce extends LuceneTestCaseJ4 {+public class TestSetOnce extends LuceneTestCase {private static final class SetOnceThread extends Thread {SetOnce<Integer> set;diff --git a/lucene/src/test/org/apache/lucene/util/_TestUtil.java b/lucene/src/test/org/apache/lucene/util/_TestUtil.javaindex a77dabfc430..cc709bff2c5 100644--- a/lucene/src/test/org/apache/lucene/util/_TestUtil.java+++ b/lucene/src/test/org/apache/lucene/util/_TestUtil.java@@ -36,7 +36,7 @@ public class _TestUtil {/** Returns temp dir, containing String arg in its name;* does not create the directory. */public static File getTempDir(String desc) {- return new File(LuceneTestCaseJ4.TEMP_DIR, desc + "." + new Random().nextLong());+ return new File(LuceneTestCase.TEMP_DIR, desc + "." + new Random().nextLong());}public static void rmDir(File dir) throws IOException {diff --git a/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminism.java b/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminism.javaindex 26f72af3c62..fb51e3cd969 100644--- a/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminism.java+++ b/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminism.java@@ -26,7 +26,7 @@ import org.apache.lucene.util.LuceneTestCase;public class TestDeterminism extends LuceneTestCase {@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();}diff --git a/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java b/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.javaindex e2afb17b1fd..cd9a2f5b8b5 100644--- a/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java+++ b/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java@@ -27,7 +27,7 @@ import java.util.Random;public class TestUTF32ToUTF8 extends LuceneTestCase {@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();}diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/charfilter/HTMLStripCharFilterTest.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/charfilter/HTMLStripCharFilterTest.javaindex 249e3e2d62c..604f9668d53 100644--- a/modules/analysis/common/src/test/org/apache/lucene/analysis/charfilter/HTMLStripCharFilterTest.java+++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/charfilter/HTMLStripCharFilterTest.java@@ -18,8 +18,6 @@ package org.apache.lucene.analysis.charfilter;*/import java.io.BufferedReader;-import java.io.File;-import java.io.FileReader;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;@@ -34,18 +32,13 @@ import org.apache.lucene.util.LuceneTestCase;public class HTMLStripCharFilterTest extends LuceneTestCase {-- public HTMLStripCharFilterTest(String s) {- super(s);- }-@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {super.tearDown();}//this is some text here is a link and another link . This is an entity: & plus a <. Here is an &diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/charfilter/TestMappingCharFilter.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/charfilter/TestMappingCharFilter.javaindex 448a5c70d70..fde3cee0953 100644--- a/modules/analysis/common/src/test/org/apache/lucene/analysis/charfilter/TestMappingCharFilter.java+++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/charfilter/TestMappingCharFilter.java@@ -30,7 +30,7 @@ public class TestMappingCharFilter extends BaseTokenStreamTestCase {NormalizeCharMap normMap;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();normMap = new NormalizeCharMap();diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestAnalyzers.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestAnalyzers.javaindex febda6fe29b..5976fbd97f3 100644--- a/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestAnalyzers.java+++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestAnalyzers.java@@ -39,10 +39,6 @@ import org.apache.lucene.util.Version;public class TestAnalyzers extends BaseTokenStreamTestCase {- public TestAnalyzers(String name) {- super(name);- }-public void testSimple() throws Exception {Analyzer a = new SimpleAnalyzer(TEST_VERSION_CURRENT);assertAnalyzesTo(a, "foo bar FOO BAR",diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestKeywordAnalyzer.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestKeywordAnalyzer.javaindex a8fbc731d93..5dc33fd3482 100644--- a/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestKeywordAnalyzer.java+++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestKeywordAnalyzer.java@@ -39,7 +39,7 @@ public class TestKeywordAnalyzer extends BaseTokenStreamTestCase {private IndexSearcher searcher;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();directory = new RAMDirectory();IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestStopAnalyzer.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestStopAnalyzer.javaindex a453d62ec8d..d602b172d9f 100644--- a/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestStopAnalyzer.java+++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestStopAnalyzer.java@@ -34,13 +34,9 @@ public class TestStopAnalyzer extends BaseTokenStreamTestCase {private StopAnalyzer stop = new StopAnalyzer(TEST_VERSION_CURRENT);private Set<Object> inValidTokens = new HashSet<Object>();-- public TestStopAnalyzer(String s) {- super(s);- }@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();Iterator<?> it = StopAnalyzer.ENGLISH_STOP_WORDS_SET.iterator();diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestLimitTokenCountAnalyzer.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestLimitTokenCountAnalyzer.javaindex 7f54994bcc3..361994c4cdf 100644--- a/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestLimitTokenCountAnalyzer.java+++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestLimitTokenCountAnalyzer.java@@ -28,10 +28,6 @@ import org.apache.lucene.util.Version;public class TestLimitTokenCountAnalyzer extends BaseTokenStreamTestCase {- public TestLimitTokenCountAnalyzer(String name) {- super(name);- }-public void testLimitTokenCountAnalyzer() throws IOException {Analyzer a = new LimitTokenCountAnalyzer(new WhitespaceAnalyzer(TEST_VERSION_CURRENT), 2);// dont use assertAnalyzesTo here, as the end offset is not the end of the string!diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/EdgeNGramTokenFilterTest.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/EdgeNGramTokenFilterTest.javaindex 903e254408f..6c3fa686358 100644--- a/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/EdgeNGramTokenFilterTest.java+++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/EdgeNGramTokenFilterTest.java@@ -30,7 +30,7 @@ public class EdgeNGramTokenFilterTest extends BaseTokenStreamTestCase {private TokenStream input;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();input = new WhitespaceTokenizer(TEST_VERSION_CURRENT, new StringReader("abcde"));}diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/EdgeNGramTokenizerTest.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/EdgeNGramTokenizerTest.javaindex 159df05953a..cf2686b65cb 100644--- a/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/EdgeNGramTokenizerTest.java+++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/EdgeNGramTokenizerTest.java@@ -29,7 +29,7 @@ public class EdgeNGramTokenizerTest extends BaseTokenStreamTestCase {private StringReader input;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();input = new StringReader("abcde");}diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/NGramTokenFilterTest.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/NGramTokenFilterTest.javaindex 9443a25976f..dfd4467355c 100644--- a/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/NGramTokenFilterTest.java+++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/NGramTokenFilterTest.java@@ -30,7 +30,7 @@ public class NGramTokenFilterTest extends BaseTokenStreamTestCase {private TokenStream input;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();input = new WhitespaceTokenizer(TEST_VERSION_CURRENT, new StringReader("abcde"));}diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/NGramTokenizerTest.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/NGramTokenizerTest.javaindex b41e3e4d1ca..08289f80fc4 100644--- a/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/NGramTokenizerTest.java+++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/NGramTokenizerTest.java@@ -29,7 +29,7 @@ public class NGramTokenizerTest extends BaseTokenStreamTestCase {private StringReader input;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();input = new StringReader("abcde");}diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/NumericPayloadTokenFilterTest.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/NumericPayloadTokenFilterTest.javaindex aa6b2cd4606..0131d59ba85 100644--- a/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/NumericPayloadTokenFilterTest.java+++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/NumericPayloadTokenFilterTest.java@@ -29,11 +29,6 @@ import java.io.StringReader;public class NumericPayloadTokenFilterTest extends BaseTokenStreamTestCase {-- public NumericPayloadTokenFilterTest(String s) {- super(s);- }-public void test() throws IOException {String test = "The quick red fox jumped over the lazy brown dogs";diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/TokenOffsetPayloadTokenFilterTest.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/TokenOffsetPayloadTokenFilterTest.javaindex 371e45c1b16..02bebe35836 100644--- a/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/TokenOffsetPayloadTokenFilterTest.java+++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/TokenOffsetPayloadTokenFilterTest.java@@ -27,11 +27,6 @@ import java.io.StringReader;public class TokenOffsetPayloadTokenFilterTest extends BaseTokenStreamTestCase {-- public TokenOffsetPayloadTokenFilterTest(String s) {- super(s);- }-public void test() throws IOException {String test = "The quick red fox jumped over the lazy brown dogs";diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/TypeAsPayloadTokenFilterTest.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/TypeAsPayloadTokenFilterTest.javaindex 35fa092e02e..44fd471b748 100644--- a/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/TypeAsPayloadTokenFilterTest.java+++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/TypeAsPayloadTokenFilterTest.java@@ -29,11 +29,6 @@ import java.io.StringReader;public class TypeAsPayloadTokenFilterTest extends BaseTokenStreamTestCase {-- public TypeAsPayloadTokenFilterTest(String s) {- super(s);- }-public void test() throws IOException {String test = "The quick red fox jumped over the lazy brown dogs";diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.javaindex 26512acb75d..7f7b6d64ff4 100644--- a/modules/analysis/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java+++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java@@ -47,7 +47,7 @@ public class QueryAutoStopWordAnalyzerTest extends BaseTokenStreamTestCase {QueryAutoStopWordAnalyzer protectedAnalyzer;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();dir = new RAMDirectory();appAnalyzer = new WhitespaceAnalyzer(TEST_VERSION_CURRENT);@@ -67,7 +67,7 @@ public class QueryAutoStopWordAnalyzerTest extends BaseTokenStreamTestCase {}@Override- protected void tearDown() throws Exception {+ public void tearDown() throws Exception {reader.close();super.tearDown();}diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/shingle/ShingleFilterTest.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/shingle/ShingleFilterTest.javaindex 34ffcb8b457..a0268d19210 100644--- a/modules/analysis/common/src/test/org/apache/lucene/analysis/shingle/ShingleFilterTest.java+++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/shingle/ShingleFilterTest.java@@ -788,7 +788,7 @@ public class ShingleFilterTest extends BaseTokenStreamTestCase {};@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();testTokenWithHoles = new Token[] {createToken("please", 0, 6),diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/shingle/TestShingleMatrixFilter.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/shingle/TestShingleMatrixFilter.javaindex a6f3e112aa8..323811ac164 100644--- a/modules/analysis/common/src/test/org/apache/lucene/analysis/shingle/TestShingleMatrixFilter.java+++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/shingle/TestShingleMatrixFilter.java@@ -40,10 +40,6 @@ import org.apache.lucene.analysis.tokenattributes.TypeAttribute;public class TestShingleMatrixFilter extends BaseTokenStreamTestCase {- public TestShingleMatrixFilter(String name) {- super(name);- }-public void testIterator() throws IOException {WhitespaceTokenizer wst = new WhitespaceTokenizer(TEST_VERSION_CURRENT, new StringReader("one two three four five"));diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/DateRecognizerSinkTokenizerTest.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/DateRecognizerSinkTokenizerTest.javaindex 344fbded5ff..c7dbefd269f 100644--- a/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/DateRecognizerSinkTokenizerTest.java+++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/DateRecognizerSinkTokenizerTest.java@@ -26,11 +26,6 @@ import org.apache.lucene.analysis.core.WhitespaceTokenizer;public class DateRecognizerSinkTokenizerTest extends BaseTokenStreamTestCase {-- public DateRecognizerSinkTokenizerTest(String s) {- super(s);- }-public void test() throws IOException {DateRecognizerSinkFilter sinkFilter = new DateRecognizerSinkFilter(new SimpleDateFormat("MM/dd/yyyy", Locale.US));String test = "The quick red fox jumped over the lazy brown dogs on 7/11/2006 The dogs finally reacted on 7/12/2006";diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TestTeeSinkTokenFilter.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TestTeeSinkTokenFilter.javaindex 36bb367c3a4..b12c8624808 100644--- a/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TestTeeSinkTokenFilter.java+++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TestTeeSinkTokenFilter.java@@ -39,7 +39,6 @@ import org.apache.lucene.util.AttributeSource;import org.apache.lucene.util.English;import java.io.IOException;import java.io.StringReader;-import java.util.Random;/**@@ -51,13 +50,8 @@ public class TestTeeSinkTokenFilter extends BaseTokenStreamTestCase {protected String[] tokens1;protected String[] tokens2;-- public TestTeeSinkTokenFilter(String s) {- super(s);- }-@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();tokens1 = new String[]{"The", "quick", "Burgundy", "Fox", "jumped", "over", "the", "lazy", "Red", "Dogs"};tokens2 = new String[]{"The", "Lazy", "Dogs", "should", "stay", "on", "the", "porch"};diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TokenRangeSinkTokenizerTest.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TokenRangeSinkTokenizerTest.javaindex 10d9cc4fe67..98cc3dc65ed 100644--- a/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TokenRangeSinkTokenizerTest.java+++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TokenRangeSinkTokenizerTest.java@@ -24,11 +24,6 @@ import org.apache.lucene.analysis.core.WhitespaceTokenizer;public class TokenRangeSinkTokenizerTest extends BaseTokenStreamTestCase {-- public TokenRangeSinkTokenizerTest(String s) {- super(s);- }-public void test() throws IOException {TokenRangeSinkFilter sinkFilter = new TokenRangeSinkFilter(2, 4);String test = "The quick red fox jumped over the lazy brown dogs";diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TokenTypeSinkTokenizerTest.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TokenTypeSinkTokenizerTest.javaindex ab623452dd3..ba8428aa55e 100644--- a/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TokenTypeSinkTokenizerTest.java+++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TokenTypeSinkTokenizerTest.java@@ -28,10 +28,6 @@ import org.apache.lucene.analysis.tokenattributes.TypeAttribute;public class TokenTypeSinkTokenizerTest extends BaseTokenStreamTestCase {- public TokenTypeSinkTokenizerTest(String s) {- super(s);- }-public void test() throws IOException {TokenTypeSinkFilter sinkFilter = new TokenTypeSinkFilter("D");String test = "The quick red fox jumped over the lazy brown dogs";diff --git a/modules/analysis/icu/src/test/org/apache/lucene/analysis/icu/segmentation/TestLaoBreakIterator.java b/modules/analysis/icu/src/test/org/apache/lucene/analysis/icu/segmentation/TestLaoBreakIterator.javaindex a46d0907491..9f86156b8f5 100644--- a/modules/analysis/icu/src/test/org/apache/lucene/analysis/icu/segmentation/TestLaoBreakIterator.java+++ b/modules/analysis/icu/src/test/org/apache/lucene/analysis/icu/segmentation/TestLaoBreakIterator.java@@ -33,7 +33,7 @@ public class TestLaoBreakIterator extends LuceneTestCase {private BreakIterator wordIterator;@Override- protected void setUp() throws Exception {+ public void setUp() throws Exception {super.setUp();InputStream is = getClass().getResourceAsStream("Lao.brk");wordIterator = new LaoBreakIterator(RuleBasedBreakIterator.getInstanceFromCompiledRules(is));diff --git a/solr/src/test/org/apache/solr/SolrTestCaseJ4.java b/solr/src/test/org/apache/solr/SolrTestCaseJ4.javaindex 83c24950f0b..148b6622157 100755--- a/solr/src/test/org/apache/solr/SolrTestCaseJ4.java+++ b/solr/src/test/org/apache/solr/SolrTestCaseJ4.java@@ -19,7 +19,7 @@package org.apache.solr;-import org.apache.lucene.util.LuceneTestCaseJ4;+import org.apache.lucene.util.LuceneTestCase;import org.apache.solr.common.SolrException;import org.apache.solr.common.SolrInputDocument;import org.apache.solr.common.SolrInputField;@@ -51,7 +51,7 @@ import static org.junit.Assert.fail;* Unlike AbstractSolrTestCase, a new core is not created for each test method.**/-public abstract class SolrTestCaseJ4 extends LuceneTestCaseJ4 {+public abstract class SolrTestCaseJ4 extends LuceneTestCase {@BeforeClasspublic static void beforeClassSolrTestCase() throws Exception {diff --git a/solr/src/test/org/apache/solr/core/TestPropInject.java b/solr/src/test/org/apache/solr/core/TestPropInject.javaindex 1db6d0ebbca..6a8046213f5 100644--- a/solr/src/test/org/apache/solr/core/TestPropInject.java+++ b/solr/src/test/org/apache/solr/core/TestPropInject.java@@ -14,10 +14,7 @@ public class TestPropInject extends AbstractSolrTestCase {}public String getSolrConfigFile() {- if ("testMergePolicyDefaults".equals(getName()) || "testPropsDefaults".equals(getName()))- return "solrconfig-propinject-indexdefault.xml";- else- return "solrconfig-propinject.xml";+ return "solrconfig-propinject.xml";}class ExposeWriterHandler extends DirectUpdateHandler2 {@@ -38,14 +35,6 @@ public class TestPropInject extends AbstractSolrTestCase {assertEquals(64.0, mp.getMaxMergeMB());uh.close();}-- public void testMergePolicyDefaults() throws Exception {- ExposeWriterHandler uh = new ExposeWriterHandler();- IndexWriter writer = uh.getWriter();- LogByteSizeMergePolicy mp = (LogByteSizeMergePolicy)writer.getMergePolicy();- assertEquals(32.0, mp.getMaxMergeMB());- uh.close();- }public void testProps() throws Exception {ExposeWriterHandler uh = new ExposeWriterHandler();@@ -54,12 +43,4 @@ public class TestPropInject extends AbstractSolrTestCase {assertEquals(2, cms.getMaxThreadCount());uh.close();}-- public void testPropsDefaults() throws Exception {- ExposeWriterHandler uh = new ExposeWriterHandler();- IndexWriter writer = uh.getWriter();- ConcurrentMergeScheduler cms = (ConcurrentMergeScheduler)writer.getMergeScheduler();- assertEquals(4, cms.getMaxThreadCount());- uh.close();- }}diff --git a/solr/src/test/org/apache/solr/core/TestPropInjectDefaults.java b/solr/src/test/org/apache/solr/core/TestPropInjectDefaults.javanew file mode 100644index 00000000000..ffebf5a3847--- /dev/null+++ b/solr/src/test/org/apache/solr/core/TestPropInjectDefaults.java@@ -0,0 +1,68 @@+package org.apache.solr.core;++/**+ * Licensed to the Apache Software Foundation (ASF) under one or more+ * contributor license agreements. See the NOTICE file distributed with+ * this work for additional information regarding copyright ownership.+ * The ASF licenses this file to You under the Apache License, Version 2.0+ * (the "License"); you may not use this file except in compliance with+ * the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import java.io.IOException;++import org.apache.lucene.index.ConcurrentMergeScheduler;+import org.apache.lucene.index.IndexWriter;+import org.apache.lucene.index.LogByteSizeMergePolicy;+import org.apache.solr.update.DirectUpdateHandler2;+import org.apache.solr.util.AbstractSolrTestCase;++public class TestPropInjectDefaults extends AbstractSolrTestCase {++ @Override+ public String getSchemaFile() {+ return "schema.xml";+ }++ @Override+ public String getSolrConfigFile() {+ return "solrconfig-propinject-indexdefault.xml";+ }++ class ExposeWriterHandler extends DirectUpdateHandler2 {+ public ExposeWriterHandler() throws IOException {+ super(h.getCore());+ }++ public IndexWriter getWriter() throws IOException {+ forceOpenWriter();+ return writer;+ }+ }++ public void testMergePolicyDefaults() throws Exception {+ ExposeWriterHandler uh = new ExposeWriterHandler();+ IndexWriter writer = uh.getWriter();+ LogByteSizeMergePolicy mp = (LogByteSizeMergePolicy)writer.getMergePolicy();+ assertEquals(32.0, mp.getMaxMergeMB());+ uh.close();+ }+++ public void testPropsDefaults() throws Exception {+ ExposeWriterHandler uh = new ExposeWriterHandler();+ IndexWriter writer = uh.getWriter();+ ConcurrentMergeScheduler cms = (ConcurrentMergeScheduler)writer.getMergeScheduler();+ assertEquals(4, cms.getMaxThreadCount());+ uh.close();+ }++}diff --git a/solr/src/test/org/apache/solr/schema/LegacyDateFieldTest.java b/solr/src/test/org/apache/solr/schema/LegacyDateFieldTest.javaindex a14c6a58d23..1e89e1a1caa 100644--- a/solr/src/test/org/apache/solr/schema/LegacyDateFieldTest.java+++ b/solr/src/test/org/apache/solr/schema/LegacyDateFieldTest.java@@ -20,14 +20,16 @@ package org.apache.solr.schema;import org.apache.solr.schema.DateField;import org.apache.solr.util.DateMathParser;import org.apache.lucene.document.Fieldable;-import org.apache.lucene.util.LocalizedTestCase;+import org.apache.lucene.util.LuceneTestCase;+import org.junit.runner.RunWith;import java.util.Date;import java.util.TimeZone;import java.util.Locale;import java.text.DateFormat;-public class LegacyDateFieldTest extends LocalizedTestCase {+@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)+public class LegacyDateFieldTest extends LuceneTestCase {// if and when this class is removed, make sure to refactor all// appropriate code to DateFieldTestdiff --git a/solr/src/test/org/apache/solr/util/DateMathParserTest.java b/solr/src/test/org/apache/solr/util/DateMathParserTest.javaindex ff48840db01..7b344f716a4 100644--- a/solr/src/test/org/apache/solr/util/DateMathParserTest.java+++ b/solr/src/test/org/apache/solr/util/DateMathParserTest.java@@ -17,8 +17,9 @@package org.apache.solr.util;-import org.apache.lucene.util.LocalizedTestCase;+import org.apache.lucene.util.LuceneTestCase;import org.apache.solr.util.DateMathParser;+import org.junit.runner.RunWith;import java.text.SimpleDateFormat;import java.text.DateFormat;@@ -34,7 +35,8 @@ import java.text.ParseException;/*** Tests that the functions in DateMathParser*/-public class DateMathParserTest extends LocalizedTestCase {+@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)+public class DateMathParserTest extends LuceneTestCase {public static TimeZone UTC = TimeZone.getTimeZone("UTC");