Package org.junit.jupiter.api
Interface MethodDescriptor
-
@API(status=EXPERIMENTAL, since="5.4") public interface MethodDescriptorMethodDescriptorencapsulates 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 java.lang.annotation.Annotation>
java.util.Optional<A>findAnnotation(java.lang.Class<A> annotationType)Find the first annotation ofannotationTypethat is either present or meta-present on theMethodfor this descriptor.<A extends java.lang.annotation.Annotation>
java.util.List<A>findRepeatableAnnotations(java.lang.Class<A> annotationType)Find all repeatable annotations ofannotationTypethat are either present or meta-present on theMethodfor this descriptor.java.lang.reflect.MethodgetMethod()Get the method for this descriptor.booleanisAnnotated(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)Determine if an annotation ofannotationTypeis either present or meta-present on theMethodfor this descriptor.
-
-
-
Method Detail
-
getMethod
java.lang.reflect.Method getMethod()
Get the method for this descriptor.- Returns:
- the method; never
null
-
isAnnotated
boolean isAnnotated(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Determine if an annotation ofannotationTypeis either present or meta-present on theMethodfor this descriptor.- Parameters:
annotationType- the annotation type to search for; nevernull- Returns:
trueif the annotation is present or meta-present- See Also:
findAnnotation(Class),findRepeatableAnnotations(Class)
-
findAnnotation
<A extends java.lang.annotation.Annotation> java.util.Optional<A> findAnnotation(java.lang.Class<A> annotationType)
Find the first annotation ofannotationTypethat is either present or meta-present on theMethodfor this descriptor.- Type Parameters:
A- the annotation type- Parameters:
annotationType- the annotation type to search for; nevernull- Returns:
- an
Optionalcontaining the annotation; nevernullbut potentially empty - See Also:
isAnnotated(Class),findRepeatableAnnotations(Class)
-
findRepeatableAnnotations
<A extends java.lang.annotation.Annotation> java.util.List<A> findRepeatableAnnotations(java.lang.Class<A> annotationType)
Find all repeatable annotations ofannotationTypethat are either present or meta-present on theMethodfor 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
nullnor mutable, but potentially empty - See Also:
isAnnotated(Class),findAnnotation(Class),Repeatable
-
-