MartijnVisser commented on code in PR #30179:
URL: https://github.com/apache/flink/pull/30179#discussion_r4740596286


##########
flink-architecture-tests/flink-architecture-tests-test/src/main/java/org/apache/flink/architecture/rules/BanJunit4Rules.java:
##########
@@ -18,23 +18,47 @@
 
 package org.apache.flink.architecture.rules;
 
+import com.tngtech.archunit.base.DescribedPredicate;
+import com.tngtech.archunit.core.domain.JavaClass;
 import com.tngtech.archunit.junit.ArchTest;
 import com.tngtech.archunit.lang.ArchRule;
 
+import static com.tngtech.archunit.base.DescribedPredicate.not;
+import static 
com.tngtech.archunit.core.domain.JavaClass.Predicates.resideInAnyPackage;
+import static com.tngtech.archunit.lang.conditions.ArchConditions.be;
 import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses;
 import static com.tngtech.archunit.library.freeze.FreezingArchRule.freeze;
 
 /** Rules for modules already completed the migration of junit5. */
 public class BanJunit4Rules {
 
+    private static final DescribedPredicate<JavaClass> JUNIT4_CLASSES =
+            resideInAnyPackage("junit..", "org.junit..")
+                    .and(not(resideInAnyPackage("org.junit.jupiter..", 
"org.junit.platform..")))
+                    .as("JUnit 4 classes");
+
+    // Catches tests that get JUnit 4 through a base class such as TestLogger 
without referencing
+    // JUnit 4 themselves.
+    private static final DescribedPredicate<JavaClass> 
SUBCLASS_OF_JUNIT4_CLASS =
+            DescribedPredicate.describe(
+                    "a subclass of a class that depends on JUnit 4",

Review Comment:
   It might help to name the base class in the violation. For 
`SourceReaderBaseTest` it doesn't say that `SourceReaderTestBase` is the one 
bringing in JUnit 4.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to