This is an automated email from the ASF dual-hosted git repository.

cpoerschke pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new 68c93e8  SOLR-15225: maintain existing test naming conventions 
(contrib/analytics, contrib/ltr) (#9)
68c93e8 is described below

commit 68c93e861f78284183b2eeca9cf18c1de3288ee2
Author: Christine Poerschke <[email protected]>
AuthorDate: Thu Apr 1 17:14:26 2021 +0100

    SOLR-15225: maintain existing test naming conventions (contrib/analytics, 
contrib/ltr) (#9)
---
 .../src/java/org/apache/solr/SolrTestCase.java               | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java 
b/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
index 011425f..b215c69 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
@@ -19,10 +19,12 @@ package org.apache.solr;
 
 import java.lang.invoke.MethodHandles;
 import java.io.File;
+import java.util.regex.Pattern;
 
 import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.QuickPatchThreadsFilter;
+import org.apache.lucene.util.VerifyTestClassNamingConvention;
 import org.apache.solr.servlet.SolrDispatchFilter;
 import org.apache.solr.util.ExternalPaths;
 import org.apache.solr.util.RevertDefaultThreadHandlerRule;
@@ -75,9 +77,19 @@ public class SolrTestCase extends LuceneTestCase {
    */
   private static final Logger log = 
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
+  private static final Pattern NAMING_CONVENTION_TEST_SUFFIX = 
Pattern.compile("(.+\\.)([^.]+)(Test)");
+
+  private static final Pattern NAMING_CONVENTION_TEST_PREFIX = 
Pattern.compile("(.+\\.)(Test)([^.]+)");
+
   @ClassRule
   public static TestRule solrClassRules = 
     RuleChain.outerRule(new SystemPropertiesRestoreRule())
+             .around(
+                 new VerifyTestClassNamingConvention(
+                     "org.apache.solr.analytics", 
NAMING_CONVENTION_TEST_SUFFIX))
+             .around(
+                 new VerifyTestClassNamingConvention(
+                     "org.apache.solr.ltr", NAMING_CONVENTION_TEST_PREFIX))
              .around(new RevertDefaultThreadHandlerRule());
 
   /**

Reply via email to