-
Notifications
You must be signed in to change notification settings - Fork 163
feat: Support Junit 5 meta-annotations and composed annotations #756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| * @param annotationToSearch The annotation string. | ||
| * @param checkHierarchy Specify whether to search the whole annotation hierarchy. | ||
| */ | ||
| public static boolean hasAnnotation(IMember member, String annotationToSearch, boolean checkHierarchy) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would Inherited be more proper than hierarchy? e.g. checkInherited
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
includeInherited looks even better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, actually the annotation we treated here is not inherited. That's why it is called meta-annotation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exactly, not inherited. From the saying meta-annotation, it's annotation of an annotation, and it is, more like aggregation/combination.
Anyway, use whatever proper name you like.
Eskibear
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Suggest to add test cases to guard the utitilities later.
| } | ||
| for (final String annotation : this.testMethodAnnotations) { | ||
| if (TestFrameworkUtils.hasAnnotation(method, annotation)) { | ||
| if (TestFrameworkUtils.hasAnnotation(method, annotation, false /*checkHierarchy*/)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually you might simply overload hasAnnotation, to avoid changing these statements.
boolean hasAnnotation(method, anno) {
return hasAnnotation(method, anno, false);
}
boolean hasAnnotation(method, anno, boolean) {
// ...
}
resolve #737
By searching the annotation hierarchy, we can resolve the meta-annotation scenario.