Class NestedMethodSelector
- All Implemented Interfaces:
DiscoverySelector
DiscoverySelector that selects a nested Method or a
combination of enclosing class names, class name, method name, and parameter
types so that TestEngines can
discover tests or containers based on methods.
If a Java Method is provided, the selector will return that
method and its method name, class name, enclosing
class names, and parameter types accordingly. If class names or method names
are provided, this selector will only attempt to lazily load a class or method
if getEnclosingClasses(), getNestedClass(),
getMethod(), or getParameterTypes() is invoked.
In this context, a Java Method means anything that can be referenced
as a Method on the JVM — for example, methods from Java classes
or methods from other JVM languages such Groovy, Scala, etc.
- Since:
- 1.6
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Method Summary
Modifier and TypeMethodDescriptionboolean@Nullable ClassLoaderGet theClassLoaderused to load the nested class.Get the names of the classes enclosing the nested class containing the selected method.Get the selectedMethod.Get the name of the selected method.Class<?> Get the name of the nested class containing the selected method.Get the names of parameter types for the selected method as aString.Class<?>[]Get the parameter types for the selected method.inthashCode()Return the identifier of this selector.toString()
-
Method Details
-
getClassLoader
Get theClassLoaderused to load the nested class.- Since:
- 1.10
-
getEnclosingClassNames
-
getEnclosingClasses
Get the list ofClassenclosing the nestedClasscontaining the selectedMethod.If the
Classwere not provided, but only the name of the nested class and its enclosing classes, this method attempts to lazily load the list of enclosingClassand throws aPreconditionViolationExceptionif the classes cannot be loaded. -
getNestedClassName
Get the name of the nested class containing the selected method. -
getNestedClass
Get the nestedClasscontaining the selectedMethod.If the
Classwere not provided, but only the name of the nested class and its enclosing classes, this method attempts to lazily load the nestedClassand throws aPreconditionViolationExceptionif the class cannot be loaded. -
getMethodName
Get the name of the selected method. -
getMethod
Get the selectedMethod.If the
Methodwas not provided, but only the name, this method attempts to lazily load theMethodbased on its name and throws aPreconditionViolationExceptionif the method cannot be loaded. -
getParameterTypeNames
Get the names of parameter types for the selected method as aString.See
MethodSelector.getParameterTypeNames()for details.- Returns:
- the names of parameter types supplied to this
NestedMethodSelectorvia a constructor or deduced from aMethodor parameter types supplied via a constructor; nevernullbut potentially an empty string - Since:
- 1.10
- See Also:
-
getParameterTypes
Get the parameter types for the selected method.See
MethodSelector.getParameterTypes()for details.- Returns:
- the method's parameter types; never
nullbut potentially an empty array if the selected method does not declare parameters - Since:
- 1.10
- See Also:
-
equals
-
hashCode
-
toString
-
toIdentifier
Description copied from interface:DiscoverySelectorReturn the identifier of this selector.The returned identifier must be parsable by a corresponding
DiscoverySelectorIdentifierParser.The default implementation returns
Optional.empty(). Can be overridden by concrete implementations.- Specified by:
toIdentifierin interfaceDiscoverySelector- Returns:
- an
Optionalcontaining the identifier of this selector; nevernullbut potentially empty if the selector does not support identifiers
-