Class ClassSelector
- All Implemented Interfaces:
DiscoverySelector
DiscoverySelector that selects a Class or class name so
that TestEngines can discover
tests or containers based on classes.
If a Java Class reference is provided, the selector will return
that Class and its class name accordingly. If a class name is
provided, the selector will only attempt to lazily load the Class
if getJavaClass() is invoked.
In this context, Java Class means anything that can be referenced
as a Class on the JVM — for example, classes from other JVM
languages such Groovy, Scala, etc.
- Since:
- 1.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Method Summary
Modifier and TypeMethodDescriptionboolean@Nullable ClassLoaderGet theClassLoaderused to load the selected class.Get the selected class name.Class<?> Get the selectedClass.inthashCode()Return the identifier of this selector.toString()
-
Method Details
-
getClassLoader
Get theClassLoaderused to load the selected class.- Returns:
- the
ClassLoader; potentiallynull - Since:
- 1.10
-
getClassName
Get the selected class name. -
getJavaClass
Get the selectedClass.If the
Classwas not provided, but only the name, this method attempts to lazily load theClassbased on its name and throws aPreconditionViolationExceptionif the class cannot be loaded. -
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
-