Airblader commented on a change in pull request #18333:
URL: https://github.com/apache/flink/pull/18333#discussion_r783961864
##########
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:
I think we should remove unused code, even if it's test code.
Effectively we don't know whether these functions work.
--
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]