Class DefaultMethodDescriptor
- java.lang.Object
-
- org.junit.jupiter.engine.discovery.DefaultMethodDescriptor
-
- All Implemented Interfaces:
MethodDescriptor
class DefaultMethodDescriptor extends java.lang.Object implements MethodDescriptor
Default implementation ofMethodDescriptor, backed by aMethodBasedTestDescriptor.- Since:
- 5.4
-
-
Field Summary
Fields Modifier and Type Field Description private MethodBasedTestDescriptortestDescriptor
-
Constructor Summary
Constructors Constructor Description DefaultMethodDescriptor(MethodBasedTestDescriptor testDescriptor)
-
Method Summary
All Methods Instance Methods Concrete 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.StringgetDisplayName()Get the display name for this descriptor'smethod.java.lang.reflect.MethodgetMethod()Get the method for this descriptor.(package private) MethodBasedTestDescriptorgetTestDescriptor()booleanisAnnotated(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)Determine if an annotation ofannotationTypeis either present or meta-present on theMethodfor this descriptor.java.lang.StringtoString()
-
-
-
Field Detail
-
testDescriptor
private final MethodBasedTestDescriptor testDescriptor
-
-
Constructor Detail
-
DefaultMethodDescriptor
DefaultMethodDescriptor(MethodBasedTestDescriptor testDescriptor)
-
-
Method Detail
-
getTestDescriptor
MethodBasedTestDescriptor getTestDescriptor()
-
getMethod
public final java.lang.reflect.Method getMethod()
Description copied from interface:MethodDescriptorGet the method for this descriptor.- Specified by:
getMethodin interfaceMethodDescriptor- Returns:
- the method; never
null
-
getDisplayName
public final java.lang.String getDisplayName()
Description copied from interface:MethodDescriptorGet the display name for this descriptor'smethod.- Specified by:
getDisplayNamein interfaceMethodDescriptor- Returns:
- the display name for this descriptor's method; never
nullor blank
-
isAnnotated
public boolean isAnnotated(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Description copied from interface:MethodDescriptorDetermine if an annotation ofannotationTypeis either present or meta-present on theMethodfor this descriptor.- Specified by:
isAnnotatedin interfaceMethodDescriptor- Parameters:
annotationType- the annotation type to search for; nevernull- Returns:
trueif the annotation is present or meta-present- See Also:
MethodDescriptor.findAnnotation(Class),MethodDescriptor.findRepeatableAnnotations(Class)
-
findAnnotation
public <A extends java.lang.annotation.Annotation> java.util.Optional<A> findAnnotation(java.lang.Class<A> annotationType)
Description copied from interface:MethodDescriptorFind the first annotation ofannotationTypethat is either present or meta-present on theMethodfor this descriptor.- Specified by:
findAnnotationin interfaceMethodDescriptor- 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:
MethodDescriptor.isAnnotated(Class),MethodDescriptor.findRepeatableAnnotations(Class)
-
findRepeatableAnnotations
public <A extends java.lang.annotation.Annotation> java.util.List<A> findRepeatableAnnotations(java.lang.Class<A> annotationType)
Description copied from interface:MethodDescriptorFind all repeatable annotations ofannotationTypethat are either present or meta-present on theMethodfor this descriptor.- Specified by:
findRepeatableAnnotationsin interfaceMethodDescriptor- 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:
MethodDescriptor.isAnnotated(Class),MethodDescriptor.findAnnotation(Class),Repeatable
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-