Class NestedClassSelector
- java.lang.Object
-
- org.junit.platform.engine.discovery.NestedClassSelector
-
- All Implemented Interfaces:
DiscoverySelector
@API(status=STABLE, since="1.6") public class NestedClassSelector extends java.lang.Object implements DiscoverySelector
ADiscoverySelector
that selects a nestedClass
or class name enclosed in other classes so thatTestEngines
can discover tests or containers based on classes.If Java
Class
references are provided for the nested class or the enclosing classes, the selector will return theseClass
and their class names accordingly. If class names are provided, the selector will only attempt to lazily load theClass
ifgetEnclosingClasses()
orgetNestedClass()
are invoked.In this context, Java
Class
means anything that can be referenced as aClass
on the JVM — for example, classes from other JVM languages such Groovy, Scala, etc.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<ClassSelector>
enclosingClassSelectors
private ClassSelector
nestedClassSelector
-
Constructor Summary
Constructors Constructor Description NestedClassSelector(java.util.List<java.lang.Class<?>> enclosingClasses, java.lang.Class<?> nestedClass)
NestedClassSelector(java.util.List<java.lang.String> enclosingClassNames, java.lang.String nestedClassName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
java.util.List<java.lang.Class<?>>
getEnclosingClasses()
Get the list ofClass
enclosing the selected nestedClass
.java.util.List<java.lang.String>
getEnclosingClassNames()
Get the names of the classes enclosing the selected nested class.java.lang.Class<?>
getNestedClass()
Get the selected nestedClass
.java.lang.String
getNestedClassName()
Get the name of the selected nested class.int
hashCode()
java.lang.String
toString()
-
-
-
Field Detail
-
enclosingClassSelectors
private java.util.List<ClassSelector> enclosingClassSelectors
-
nestedClassSelector
private ClassSelector nestedClassSelector
-
-
Method Detail
-
getEnclosingClassNames
public java.util.List<java.lang.String> getEnclosingClassNames()
Get the names of the classes enclosing the selected nested class.
-
getEnclosingClasses
public java.util.List<java.lang.Class<?>> getEnclosingClasses()
Get the list ofClass
enclosing the selected nestedClass
.If the
Class
were not provided, but only the name of the nested class and its enclosing classes, this method attempts to lazily load the list of enclosingClass
and throws aPreconditionViolationException
if the classes cannot be loaded.
-
getNestedClassName
public java.lang.String getNestedClassName()
Get the name of the selected nested class.
-
getNestedClass
public java.lang.Class<?> getNestedClass()
Get the selected nestedClass
.If the
Class
were not provided, but only the name of the nested class and its enclosing classes, this method attempts to lazily load the nestedClass
and throws aPreconditionViolationException
if the class cannot be loaded.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-