Closed
Description
I have a use case where I have a custom annotation i.e. @MyAnnotation
that is annotated by @ExtendWith(Extension.class)
.
On a test method, I declare @MyAnnotation
and another annotation, @OtherAnnotation
.
@MyAnnotation
@OtherAnnotation
void test(){...}
I want to be able to deactivate the extension registered in MyAnnotation
(Extension.class
) when the second annotation, OtherAnnotation
is present, because JUnit Jupiter takes the extension from MyAnnotation
and runs it, but I want that MyAnnotation
could be used as a self contained annotation in other test cases.
Is there a way to tell if OtherAnnotation
is present and not run the Extension.class
in MyAnnotation
?