LUCENE-3378: add a QPTestBase for shared QP test methods

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1158861 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2011-08-17 18:34:04 +00:00
parent 8203481079
commit caf468b938
4 changed files with 1358 additions and 1311 deletions

View File

@ -22,19 +22,24 @@ import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.analysis.MockTokenizer;
import org.apache.lucene.queryparser.classic.ParseException;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.apache.lucene.queryparser.util.QueryParserTestBase;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.util.LuceneTestCase;
/**
* Testcase for the class {@link ExtendableQueryParser}
*/
public class TestExtendableQueryParser extends LuceneTestCase {
public class TestExtendableQueryParser extends QueryParserTestBase {
private static char[] DELIMITERS = new char[] {
Extensions.DEFAULT_EXTENSION_FIELD_DELIMITER, '-', '|' };
@Override
public QueryParser getParser(Analyzer a) throws Exception {
return getParser(a, null);
}
public QueryParser getParser(Analyzer a, Extensions extensions)
throws Exception {
if (a == null)

View File

@ -39,6 +39,7 @@ import org.apache.lucene.queryparser.flexible.core.QueryNodeException;
import org.apache.lucene.queryparser.flexible.core.QueryNodeParseException;
import org.apache.lucene.queryparser.flexible.standard.config.StandardQueryConfigHandler;
import org.apache.lucene.queryparser.flexible.standard.parser.ParseException;
import org.apache.lucene.queryparser.util.QueryParserTestBase; // javadocs
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.FuzzyQuery;
import org.apache.lucene.search.PhraseQuery;
@ -56,12 +57,14 @@ import org.apache.lucene.util.automaton.CharacterRunAutomaton;
* This test case tests {@link PrecedenceQueryParser}.
* </p>
* <p>
* It contains all tests from {@link org.apache.lucene.queryparser.classic.TestQueryParser}
* It contains all tests from {@link QueryParserTestBase}
* with some adjusted to fit the precedence requirement, plus some precedence test cases.
* </p>
*
* @see org.apache.lucene.queryparser.classic.TestQueryParser
* @see QueryParserTestBase
*/
//TODO: refactor this to actually extend that class, overriding the tests
//that it adjusts to fit the precedence requirement, adding its extra tests.
public class TestPrecedenceQueryParser extends LuceneTestCase {
public static Analyzer qpAnalyzer = new QPTestAnalyzer();