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 MethodBasedTestDescriptor
testDescriptor
-
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 ofannotationType
that is either present or meta-present on theMethod
for this descriptor.<A extends java.lang.annotation.Annotation>
java.util.List<A>findRepeatableAnnotations(java.lang.Class<A> annotationType)
Find all repeatable annotations ofannotationType
that are either present or meta-present on theMethod
for this descriptor.java.lang.String
getDisplayName()
Get the display name for this descriptor'smethod
.java.lang.reflect.Method
getMethod()
Get the method for this descriptor.(package private) MethodBasedTestDescriptor
getTestDescriptor()
boolean
isAnnotated(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Determine if an annotation ofannotationType
is either present or meta-present on theMethod
for this descriptor.java.lang.String
toString()
-
-
-
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:MethodDescriptor
Get the method for this descriptor.- Specified by:
getMethod
in interfaceMethodDescriptor
- Returns:
- the method; never
null
-
getDisplayName
public final java.lang.String getDisplayName()
Description copied from interface:MethodDescriptor
Get the display name for this descriptor'smethod
.- Specified by:
getDisplayName
in interfaceMethodDescriptor
- Returns:
- the display name for this descriptor's method; never
null
or blank
-
isAnnotated
public boolean isAnnotated(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Description copied from interface:MethodDescriptor
Determine if an annotation ofannotationType
is either present or meta-present on theMethod
for this descriptor.- Specified by:
isAnnotated
in interfaceMethodDescriptor
- Parameters:
annotationType
- the annotation type to search for; nevernull
- Returns:
true
if 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:MethodDescriptor
Find the first annotation ofannotationType
that is either present or meta-present on theMethod
for this descriptor.- Specified by:
findAnnotation
in interfaceMethodDescriptor
- 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:
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:MethodDescriptor
Find all repeatable annotations ofannotationType
that are either present or meta-present on theMethod
for this descriptor.- Specified by:
findRepeatableAnnotations
in 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
null
nor mutable, but potentially empty - See Also:
MethodDescriptor.isAnnotated(Class)
,MethodDescriptor.findAnnotation(Class)
,Repeatable
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-