Top Description Constructors Methods
org.junit.platform.engine.discovery

public final Class DiscoverySelectors

extends Object
Class Inheritance
Annotations
@API
status:STABLE
since:1.0
Static Imports
org.apiguardian.api.API.Status.DEPRECATED, .API.Status.EXPERIMENTAL, .API.Status.MAINTAINED, .API.Status.STABLE

Collection of static factory methods for creating DiscoverySelectors.
Since
1.0
See Also
UriSelector, FileSelector, DirectorySelector, ClasspathRootSelector, ClasspathResourceSelector, ModuleSelector, PackageSelector, ClassSelector, MethodSelector, NestedClassSelector, NestedMethodSelector, UniqueIdSelector, DiscoverySelectorIdentifier

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Optional<? extends DiscoverySelector>

Returns:

an Optional containing the corresponding DiscoverySelector; never null but potentially empty
parse
(String
the string representation of a DiscoverySelectorIdentifier; never null or blank
identifier
)

Parse the supplied string representation of a DiscoverySelectorIdentifier.

public static Optional<? extends DiscoverySelector>

Returns:

an Optional containing the corresponding DiscoverySelector; never null but potentially empty
parse
(DiscoverySelectorIdentifier
the DiscoverySelectorIdentifier to parse; never null
identifier
)

Parse the supplied DiscoverySelectorIdentifier.

public static Stream<? extends DiscoverySelector>

Returns:

a stream of the corresponding DiscoverySelectors; never null but potentially empty
parseAll
(String...
the string representations of DiscoverySelectorIdentifiers to parse; never null
identifiers
)

Parse the supplied string representations of DiscoverySelectorIdentifiers.

public static Stream<? extends DiscoverySelector>

Returns:

a stream of the corresponding DiscoverySelectors; never null but potentially empty
parseAll
(Collection<DiscoverySelectorIdentifier>
the DiscoverySelectorIdentifiers to parse; never null
identifiers
)

Parse the supplied DiscoverySelectorIdentifiers.

public static ClassSelector
selectClass(Class<?>
the class to select; never null
clazz
)

Create a ClassSelector for the supplied Class.

public static ClassSelector
selectClass(String
the fully qualified name of the class to select; never null or blank
className
)

Create a ClassSelector for the supplied class name.

public static ClassSelector
selectClass(@Nullable ClassLoader
the class loader to use to load the class, or null to signal that the default ClassLoader should be used
classLoader
,
String
the fully qualified name of the class to select; never null or blank
className
)

Create a ClassSelector for the supplied class name and class loader.

public static List<ClassSelector>
selectClasses(Class<?>...
the classes to select; never null and never containing null class references
classes
)

Create a ClassSelector for each supplied Class.

public static List<ClassSelector>
selectClasses(List<Class<?>>
the classes to select; never null and never containing null class references
classes
)

Create a ClassSelector for each supplied Class.

public static List<ClassSelector>
selectClassesByName(String...
the fully qualified names of the classes to select; never null and never containing null or blank names
classNames
)

Create a ClassSelector for each supplied class name.

public static List<ClassSelector>
selectClassesByName(List<String>
the fully qualified names of the classes to select; never null and never containing null or blank names
classNames
)

Create a ClassSelector for each supplied class name.

public static List<ClassSelector>
selectClassesByName(@Nullable ClassLoader
the class loader to use to load the classes, or null to signal that the default ClassLoader should be used
classLoader
,
String...
the fully qualified names of the classes to select; never null and never containing null or blank names
classNames
)

Create a ClassSelector for each supplied class name, using the supplied class loader.

public static List<ClassSelector>
selectClassesByName(@Nullable ClassLoader
the class loader to use to load the classes, or null to signal that the default ClassLoader should be used
classLoader
,
List<String>
the fully qualified names of the classes to select; never null and never containing null or blank names
classNames
)

Create a ClassSelector for each supplied class name, using the supplied class loader.

public static ClasspathResourceSelector
selectClasspathResource(String
the name of the classpath resource; never null or blank
classpathResourceName
)

Create a ClasspathResourceSelector for the supplied classpath resource name.

public static ClasspathResourceSelector
selectClasspathResource(String
the name of the classpath resource; never null or blank
classpathResourceName
,
@Nullable FilePosition
the position inside the classpath resource; may be null
position
)

Create a ClasspathResourceSelector for the supplied classpath resource name.

public static ClasspathResourceSelector
selectClasspathResource(Set<Resource>
a set of classpath resources; never null or empty. All resources must have the same name, may not be null or blank.
classpathResources
)
Deprecated for removal since 1.14. Please use selectClasspathResourceByName(Set) instead.

Create a ClasspathResourceSelector for the supplied classpath resources.

public static ClasspathResourceSelector
selectClasspathResourceByName(Set<? extends Resource>
a set of classpath resources; never null or empty. All resources must have the same name, may not be null or blank.
classpathResources
)

Create a ClasspathResourceSelector for the supplied classpath resources.

public static List<ClasspathRootSelector>

Returns:

a list of selectors for the supplied classpath roots; elements which do not physically exist in the filesystem will be filtered out
selectClasspathRoots
(Set<Path>
set of directories and JAR files in the filesystem that represent classpath roots; never null
classpathRoots
)

Create a list of ClasspathRootSelectors for the supplied classpath roots (directories or JAR files).

public static DirectorySelector
selectDirectory(String
the path to the directory to select; never null or blank
path
)

Create a DirectorySelector for the supplied directory path.

public static DirectorySelector
selectDirectory(File
the directory to select; never null
directory
)

Create a DirectorySelector for the supplied directory.

public static FileSelector
selectFile(String
the path to the file to select; never null or blank
path
)

Create a FileSelector for the supplied file path.

public static FileSelector
selectFile(File
the file to select; never null
file
)

Create a FileSelector for the supplied file.

public static FileSelector
selectFile(String
the path to the file to select; never null or blank
path
,
@Nullable FilePosition
the position inside the file; may be null
position
)

Create a FileSelector for the supplied file path.

public static FileSelector
selectFile(File
the file to select; never null
file
,
@Nullable FilePosition
the position inside the file; may be null
position
)

Create a FileSelector for the supplied file.

public static IterationSelector
selectIteration(DiscoverySelector
the parent selector to select iterations for; never null
parentSelector
,
int...
the iteration indices to select; never null or empty
iterationIndices
)

Create an IterationSelector for the supplied parent selector and iteration indices.

public static MethodSelector
selectMethod(String
the fully qualified name of the method to select; never null or blank
fullyQualifiedMethodName
)

Create a MethodSelector for the supplied fully qualified method name.

public static MethodSelector
selectMethod(@Nullable ClassLoader
the class loader to use to load the method's declaring class, or null to signal that the default ClassLoader should be used
classLoader
,
String
the fully qualified name of the method to select; never null or blank
fullyQualifiedMethodName
)

Create a MethodSelector for the supplied fully qualified method name and class loader.

public static MethodSelector
selectMethod(String
the fully qualified name of the class in which the method is declared, or a subclass thereof; never null or blank
className
,
String
the name of the method to select; never null or blank
methodName
)

Create a MethodSelector for the supplied class name and method name using the default class loader.

public static MethodSelector
selectMethod(@Nullable ClassLoader
the class loader to use to load the class, or null to signal that the default ClassLoader should be used
classLoader
,
String
the fully qualified name of the class in which the method is declared, or a subclass thereof; never null or blank
className
,
String
the name of the method to select; never null or blank
methodName
)

Create a MethodSelector for the supplied class name, method name, and class loader.

public static MethodSelector
selectMethod(String
the fully qualified name of the class in which the method is declared, or a subclass thereof; never null or blank
className
,
String
the name of the method to select; never null or blank
methodName
,
String
the parameter type names as a single string; never null though potentially an empty string if the method does not declare parameters
parameterTypeNames
)

Create a MethodSelector for the supplied class name, method name, and parameter type names.

public static MethodSelector
selectMethod(@Nullable ClassLoader
the class loader to use to load the class, or null to signal that the default ClassLoader should be used
classLoader
,
String
the fully qualified name of the class in which the method is declared, or a subclass thereof; never null or blank
className
,
String
the name of the method to select; never null or blank
methodName
,
String
the parameter type names as a single string; never null though potentially an empty string if the method does not declare any parameters
parameterTypeNames
)

Create a MethodSelector for the supplied class name, method name, parameter type names, and class loader.

public static MethodSelector
selectMethod(Class<?>
the class in which the method is declared, or a subclass thereof; never null
javaClass
,
String
the name of the method to select; never null or blank
methodName
)

Create a MethodSelector for the supplied Class and method name.

public static MethodSelector
selectMethod(Class<?>
the class in which the method is declared, or a subclass thereof; never null
javaClass
,
String
the name of the method to select; never null or blank
methodName
,
String
the parameter type names as a single string; never null though potentially an empty string if the method does not declare any parameters
parameterTypeNames
)

Create a MethodSelector for the supplied Class, method name, and parameter type names.

public static MethodSelector
selectMethod(String
the fully qualified name of the class in which the method is declared, or a subclass thereof; never null or blank
className
,
String
the name of the method to select; never null or blank
methodName
,
Class<?>...
the formal parameter types of the method; never null though potentially empty if the method does not declare parameters
parameterTypes
)

Create a MethodSelector for the supplied class name, method name, and parameter types.

public static MethodSelector
selectMethod(Class<?>
the class in which the method is declared, or a subclass thereof; never null
javaClass
,
String
the name of the method to select; never null or blank
methodName
,
Class<?>...
the formal parameter types of the method; never null though potentially empty if the method does not declare parameters
parameterTypes
)

Create a MethodSelector for the supplied Class, method name, and parameter types.

public static MethodSelector
selectMethod(Class<?>
the class in which the method is declared, or a subclass thereof; never null
javaClass
,
Method
the method to select; never null
method
)

Create a MethodSelector for the supplied Class and Method.

public static ModuleSelector
selectModule(String
the module name to select; never null or blank
moduleName
)

Create a ModuleSelector for the supplied module name.

public static List<ModuleSelector>
selectModules(Set<String>
the module names to select; never null, never containing null or blank
moduleNames
)

Create a list of ModuleSelectors for the supplied module names.

public static NestedClassSelector
selectNestedClass(List<Class<?>>
the path to the nested class to select; never null or empty
enclosingClasses
,
Class<?>
the nested class to select; never null
nestedClass
)

Create a NestedClassSelector for the supplied nested Class and its enclosing classes.

public static NestedClassSelector
selectNestedClass(List<String>
the names of the enclosing classes; never null or empty
enclosingClassNames
,
String
the name of the nested class to select; never null or blank
nestedClassName
)

Create a NestedClassSelector for the supplied class name and its enclosing classes' names.

public static NestedClassSelector
selectNestedClass(@Nullable ClassLoader
the class loader to use to load the enclosing and nested classes, or null to signal that the default ClassLoader should be used
classLoader
,
List<String>
the names of the enclosing classes; never null or empty
enclosingClassNames
,
String
the name of the nested class to select; never null or blank
nestedClassName
)

Create a NestedClassSelector for the supplied class name, its enclosing classes' names, and class loader.

public static NestedMethodSelector
selectNestedMethod(List<String>
the names of the enclosing classes; never null or empty
enclosingClassNames
,
String
the name of the nested class to select; never null or blank
nestedClassName
,
String
the name of the method to select; never null or blank
methodName
)

Create a NestedMethodSelector for the supplied nested class name and method name.

public static NestedMethodSelector
selectNestedMethod(@Nullable ClassLoader
the class loader to use to load the method's declaring class, or null to signal that the default ClassLoader should be used
classLoader
,
List<String>
the names of the enclosing classes; never null or empty
enclosingClassNames
,
String
the name of the nested class to select; never null or blank
nestedClassName
,
String
the name of the method to select; never null or blank
methodName
)

Create a NestedMethodSelector for the supplied nested class name, method name, and class loader.

public static NestedMethodSelector
selectNestedMethod(List<String>
the names of the enclosing classes; never null or empty
enclosingClassNames
,
String
the name of the nested class to select; never null or blank
nestedClassName
,
String
the name of the method to select; never null or blank
methodName
,
String
the parameter type names as a single string; never null though potentially an empty string if the method does not declare parameters
parameterTypeNames
)

Create a NestedMethodSelector for the supplied nested class name, method name, and parameter type names.

public static NestedMethodSelector
selectNestedMethod(@Nullable ClassLoader
the class loader to use to load the method's declaring class, or null to signal that the default ClassLoader should be used
classLoader
,
List<String>
the names of the enclosing classes; never null or empty
enclosingClassNames
,
String
the name of the nested class to select; never null or blank
nestedClassName
,
String
the name of the method to select; never null or blank
methodName
,
String
the parameter type names as a single string; never null though potentially an empty string if the method does not declare parameters
parameterTypeNames
)

Create a NestedMethodSelector for the supplied nested class name, method name, parameter type names, and class loader.

public static NestedMethodSelector
selectNestedMethod(List<String>
the names of the enclosing classes; never null or empty
enclosingClassNames
,
String
the name of the nested class to select; never null or blank
nestedClassName
,
String
the name of the method to select; never null or blank
methodName
,
Class<?>...
the formal parameter types of the method; never null though potentially empty if the method does not declare parameters
parameterTypes
)

Create a NestedMethodSelector for the supplied enclosing class names, nested class name, method name, and parameter types.

public static NestedMethodSelector
selectNestedMethod(List<Class<?>>
the path to the nested class to select; never null or empty
enclosingClasses
,
Class<?>
the nested class to select; never null
nestedClass
,
String
the name of the method to select; never null or blank
methodName
)

Create a NestedMethodSelector for the supplied nested Class and method name.

public static NestedMethodSelector
selectNestedMethod(List<Class<?>>
the path to the nested class to select; never null or empty
enclosingClasses
,
Class<?>
the nested class to select; never null
nestedClass
,
String
the name of the method to select; never null or blank
methodName
,
String
the parameter type names as a single string; never null though potentially an empty string if the method does not declare parameters
parameterTypeNames
)

Create a NestedMethodSelector for the supplied Class, method name, and parameter type names.

public static NestedMethodSelector
selectNestedMethod(List<Class<?>>
the path to the nested class to select; never null or empty
enclosingClasses
,
Class<?>
the nested class to select; never null
nestedClass
,
String
the name of the method to select; never null or blank
methodName
,
Class<?>...
the formal parameter types of the method; never null though potentially empty if the method does not declare parameters
parameterTypes
)

Create a NestedMethodSelector for the supplied enclosing classes, nested class, method name, and parameter types.

public static NestedMethodSelector
selectNestedMethod(List<Class<?>>
the path to the nested class to select; never null or empty
enclosingClasses
,
Class<?>
the nested class to select; never null
nestedClass
,
Method
the method to select; never null
method
)

Create a NestedMethodSelector for the supplied nested Class and Method.

public static PackageSelector
selectPackage(String
the package name to select; never null and never containing whitespace only
packageName
)

Create a PackageSelector for the supplied package name.

public static UniqueIdSelector
selectUniqueId(UniqueId
the UniqueId to select; never null
uniqueId
)

Create a UniqueIdSelector for the supplied UniqueId.

public static UniqueIdSelector
selectUniqueId(String
the unique ID to select; never null or blank
uniqueId
)

Create a UniqueIdSelector for the supplied unique ID.

public static UriSelector
selectUri(String
the URI to select; never null or blank
uri
)

Create a UriSelector for the supplied URI.

public static UriSelector
selectUri(URI
the URI to select; never null
uri
)

Create a UriSelector for the supplied URI.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait