Class ClasspathResourceSelector
- java.lang.Object
-
- org.junit.platform.engine.discovery.ClasspathResourceSelector
-
- All Implemented Interfaces:
DiscoverySelector
@API(status=STABLE, since="1.0") public class ClasspathResourceSelector extends java.lang.Object implements DiscoverySelector
ADiscoverySelector
that selects the name of a classpath resource so thatTestEngines
can load resources from the classpath — for example, to load XML or JSON files from the classpath, potentially within JARs.Since engines are not expected to modify the classpath, the classpath resource represented by this selector must be on the classpath of the context class loader of the thread that uses it.
- Since:
- 1.0
- See Also:
DiscoverySelectors.selectClasspathResource(String)
,ClasspathRootSelector
,getClasspathResourceName()
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
classpathResourceName
private FilePosition
position
-
Constructor Summary
Constructors Constructor Description ClasspathResourceSelector(java.lang.String classpathResourceName, FilePosition position)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
java.lang.String
getClasspathResourceName()
Get the name of the selected classpath resource.java.util.Optional<FilePosition>
getPosition()
Get the selectedFilePosition
within the classpath resource.int
hashCode()
java.lang.String
toString()
-
-
-
Field Detail
-
classpathResourceName
private final java.lang.String classpathResourceName
-
position
private final FilePosition position
-
-
Constructor Detail
-
ClasspathResourceSelector
ClasspathResourceSelector(java.lang.String classpathResourceName, FilePosition position)
-
-
Method Detail
-
getClasspathResourceName
public java.lang.String getClasspathResourceName()
Get the name of the selected classpath resource.The name of a classpath resource must follow the semantics for resource paths as defined in
ClassLoader.getResource(String)
.- See Also:
ClassLoader.getResource(String)
,ClassLoader.getResourceAsStream(String)
,ClassLoader.getResources(String)
-
getPosition
public java.util.Optional<FilePosition> getPosition()
Get the selectedFilePosition
within the classpath resource.
-
equals
@API(status=STABLE, since="1.3") public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
- Since:
- 1.3
-
hashCode
@API(status=STABLE, since="1.3") public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
- Since:
- 1.3
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-