JingGe commented on a change in pull request #18333:
URL: https://github.com/apache/flink/pull/18333#discussion_r783954954



##########
File path: 
flink-architecture-tests/src/test/java/org/apache/flink/architecture/common/Predicates.java
##########
@@ -50,5 +83,78 @@
                                 && field.getRawType().isEquivalentTo(clazz));
     }
 
+    /**
+     * Tests that the given field is {@code public final} and not {@code 
static} and of the given
+     * type {@code clazz} .
+     */
+    public static DescribedPredicate<JavaField> arePublicFinalOfTyp(Class<?> 
clazz) {
+        return 
is(ofType(clazz)).and(isPublic()).and(isFinal()).and(isNotStatic());
+    }
+
+    /**
+     * Tests that the given field is {@code public static final} and of the 
given type {@code clazz}
+     * .
+     */
+    public static DescribedPredicate<JavaField> 
arePublicStaticFinalOfTyp(Class<?> clazz) {
+        return arePublicStaticOfType(clazz).and(isFinal());
+    }
+
+    /**
+     * Tests that the given field is {@code public final} and of the given 
type {@code clazz} with
+     * exactly the given {@code annotationType}.
+     */
+    public static DescribedPredicate<JavaField> 
arePublicFinalOfTypeWithAnnotation(
+            Class<?> clazz, Class<? extends Annotation> annotationType) {
+        return arePublicFinalOfTyp(clazz).and(annotatedWith(annotationType));
+    }
+
+    /**
+     * Tests that the given field is {@code public static final} and of the 
given type {@code clazz}
+     * with exactly the given {@code annotationType}.
+     */
+    public static DescribedPredicate<JavaField> 
arePublicStaticFinalOfTypeWithAnnotation(
+            Class<?> clazz, Class<? extends Annotation> annotationType) {
+        return 
arePublicStaticFinalOfTyp(clazz).and(annotatedWith(annotationType));
+    }
+
+    /**
+     * Tests that the given field is {@code public static final} and of the 
given type. It must have
+     * any of the given {@code annotationTypes}
+     */
+    @SafeVarargs
+    public static DescribedPredicate<JavaField> 
arePublicStaticFinalOfTypeWithOneOfAnnotations(

Review comment:
       Yes, It was used during my first try while I thought the rule was to 
have the MiniCluster with one of @ClassRule and @Rule. After doing some more 
research, I realised that the field modifiers are different, therefore moved to 
`arePublicStaticFinalOfTypeWithAnnotation`. The 
`arePublicStaticFinalOfTypeWithOneOfAnnotations` and `annotatedWithOneOf` works 
fine and will be used later and I found some other unused methods in the 
codebase, since this is only about test, so I committed it on purpose.




-- 
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