mirror of https://github.com/apache/lucene.git
LUCENE-10338: Scan for tests only by convention file name pattern (#565)
This commit is contained in:
parent
eed2601542
commit
d928c47d6e
|
@ -161,6 +161,13 @@ allprojects {
|
|||
showStandardStreams false
|
||||
}
|
||||
|
||||
// Disable automatic test class detection, rely on class names only. This is needed for testing
|
||||
// against JDKs where the bytecode is unparseable by Gradle, for example.
|
||||
// We require all tests to start with Test*, this simplifies include patterns greatly.
|
||||
scanForTestClasses = false
|
||||
include '**/Test*.class'
|
||||
exclude '**/*$*'
|
||||
|
||||
// Set up custom test output handler.
|
||||
doFirst {
|
||||
project.delete testOutputsDir
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.apache.lucene.search.ScoreMode;
|
|||
import org.apache.lucene.search.SimpleCollector;
|
||||
import org.junit.Assert;
|
||||
|
||||
public class TestBooleanQuery {
|
||||
public class BooleanQueryTestFacade {
|
||||
String queryText;
|
||||
final int[] expectedDocNrs;
|
||||
SingleFieldTestDb dBase;
|
||||
|
@ -37,7 +37,7 @@ public class TestBooleanQuery {
|
|||
BasicQueryFactory qf;
|
||||
boolean verbose = true;
|
||||
|
||||
public TestBooleanQuery(
|
||||
public BooleanQueryTestFacade(
|
||||
String queryText,
|
||||
int[] expectedDocNrs,
|
||||
SingleFieldTestDb dBase,
|
|
@ -19,11 +19,11 @@ package org.apache.lucene.queryparser.surround.query;
|
|||
import org.apache.lucene.queryparser.surround.parser.ParseException;
|
||||
import org.apache.lucene.queryparser.surround.parser.QueryParser;
|
||||
|
||||
public class TestExceptionQuery {
|
||||
public class ExceptionQueryTestFacade {
|
||||
private String queryText;
|
||||
private boolean verbose;
|
||||
|
||||
public TestExceptionQuery(String queryText, boolean verbose) {
|
||||
public ExceptionQueryTestFacade(String queryText, boolean verbose) {
|
||||
this.queryText = queryText;
|
||||
this.verbose = verbose;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class TestExceptionQuery {
|
|||
public static String getFailQueries(String[] exceptionQueries, boolean verbose) {
|
||||
StringBuilder failQueries = new StringBuilder();
|
||||
for (int i = 0; i < exceptionQueries.length; i++) {
|
||||
new TestExceptionQuery(exceptionQueries[i], verbose).doTest(failQueries);
|
||||
new ExceptionQueryTestFacade(exceptionQueries[i], verbose).doTest(failQueries);
|
||||
}
|
||||
return failQueries.toString();
|
||||
}
|
|
@ -57,7 +57,7 @@ public class Test01Exceptions extends LuceneTestCase {
|
|||
};
|
||||
|
||||
public void test01Exceptions() throws Exception {
|
||||
String m = TestExceptionQuery.getFailQueries(exceptionQueries, verbose);
|
||||
String m = ExceptionQueryTestFacade.getFailQueries(exceptionQueries, verbose);
|
||||
if (m.length() > 0) {
|
||||
fail("No ParseException for:\n" + m);
|
||||
}
|
||||
|
|
|
@ -46,8 +46,8 @@ public class Test02Boolean extends LuceneTestCase {
|
|||
SingleFieldTestDb db1;
|
||||
|
||||
public void normalTest1(String query, int[] expdnrs) throws Exception {
|
||||
TestBooleanQuery tbq =
|
||||
new TestBooleanQuery(
|
||||
BooleanQueryTestFacade tbq =
|
||||
new BooleanQueryTestFacade(
|
||||
query, expdnrs, db1, fieldName, this, new BasicQueryFactory(maxBasicQueries));
|
||||
tbq.setVerbose(verbose);
|
||||
tbq.doTest();
|
||||
|
|
|
@ -41,7 +41,7 @@ public class Test03Distance extends LuceneTestCase {
|
|||
};
|
||||
|
||||
public void test00Exceptions() throws Exception {
|
||||
String m = TestExceptionQuery.getFailQueries(exceptionQueries, verbose);
|
||||
String m = ExceptionQueryTestFacade.getFailQueries(exceptionQueries, verbose);
|
||||
if (m.length() > 0) {
|
||||
fail("No ParseException for:\n" + m);
|
||||
}
|
||||
|
@ -68,8 +68,8 @@ public class Test03Distance extends LuceneTestCase {
|
|||
}
|
||||
|
||||
private void distanceTst(String query, int[] expdnrs, SingleFieldTestDb db) throws Exception {
|
||||
TestBooleanQuery tbq =
|
||||
new TestBooleanQuery(
|
||||
BooleanQueryTestFacade tbq =
|
||||
new BooleanQueryTestFacade(
|
||||
query, expdnrs, db, fieldName, this, new BasicQueryFactory(maxBasicQueries));
|
||||
tbq.setVerbose(verbose);
|
||||
tbq.doTest();
|
||||
|
|
Loading…
Reference in New Issue