diff --git a/gradle/testing/defaults-tests.gradle b/gradle/testing/defaults-tests.gradle index a6d59eee390..f497133d240 100644 --- a/gradle/testing/defaults-tests.gradle +++ b/gradle/testing/defaults-tests.gradle @@ -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 diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/TestBooleanQuery.java b/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/BooleanQueryTestFacade.java similarity index 98% rename from lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/TestBooleanQuery.java rename to lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/BooleanQueryTestFacade.java index 25c848eb9e1..2e0e19101e3 100644 --- a/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/TestBooleanQuery.java +++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/BooleanQueryTestFacade.java @@ -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, diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/TestExceptionQuery.java b/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/ExceptionQueryTestFacade.java similarity index 90% rename from lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/TestExceptionQuery.java rename to lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/ExceptionQueryTestFacade.java index 18574c3fdcb..215449672ec 100644 --- a/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/TestExceptionQuery.java +++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/ExceptionQueryTestFacade.java @@ -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(); } diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/Test01Exceptions.java b/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/Test01Exceptions.java index 75f751e5b8c..08d476a1277 100644 --- a/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/Test01Exceptions.java +++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/Test01Exceptions.java @@ -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); } diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/Test02Boolean.java b/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/Test02Boolean.java index 1a726ecd9ba..e796837ae35 100644 --- a/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/Test02Boolean.java +++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/Test02Boolean.java @@ -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(); diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/Test03Distance.java b/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/Test03Distance.java index 16f02a235d8..1a76f7bd611 100644 --- a/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/Test03Distance.java +++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/Test03Distance.java @@ -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();