Package org.junit.jupiter.api
Interface MethodDescriptor
-
@API(status=EXPERIMENTAL, since="5.4") public interface MethodDescriptor
MethodDescriptor
encapsulates functionality for a givenMethod
.- Since:
- 5.4
- See Also:
MethodOrdererContext
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <A extends Annotation>
Optional<A>findAnnotation(Class<A> annotationType)
Find the first annotation ofannotationType
that is either present or meta-present on theMethod
for this descriptor.<A extends Annotation>
List<A>findRepeatableAnnotations(Class<A> annotationType)
Find all repeatable annotations ofannotationType
that are either present or meta-present on theMethod
for this descriptor.Method
getMethod()
Get the method for this descriptor.boolean
isAnnotated(Class<? extends Annotation> annotationType)
Determine if an annotation ofannotationType
is either present or meta-present on theMethod
for this descriptor.
-
-
-
Method Detail
-
getMethod
Method getMethod()
Get the method for this descriptor.- Returns:
- the method; never
null
-
isAnnotated
boolean isAnnotated(Class<? extends Annotation> annotationType)
Determine if an annotation ofannotationType
is either present or meta-present on theMethod
for this descriptor.- Parameters:
annotationType
- the annotation type to search for; nevernull
- Returns:
true
if the annotation is present or meta-present- See Also:
findAnnotation(Class)
,findRepeatableAnnotations(Class)
-
findAnnotation
<A extends Annotation> Optional<A> findAnnotation(Class<A> annotationType)
Find the first annotation ofannotationType
that is either present or meta-present on theMethod
for this descriptor.- Type Parameters:
A
- the annotation type- Parameters:
annotationType
- the annotation type to search for; nevernull
- Returns:
- an
Optional
containing the annotation; nevernull
but potentially empty - See Also:
isAnnotated(Class)
,findRepeatableAnnotations(Class)
-
findRepeatableAnnotations
<A extends Annotation> List<A> findRepeatableAnnotations(Class<A> annotationType)
Find all repeatable annotations ofannotationType
that are either present or meta-present on theMethod
for this descriptor.- Type Parameters:
A
- the annotation type- Parameters:
annotationType
- the repeatable annotation type to search for; nevernull
- Returns:
- the list of all such annotations found; neither
null
nor mutable, but potentially empty - See Also:
isAnnotated(Class)
,findAnnotation(Class)
,Repeatable
-
-