Class ClasspathResourceSource
- All Implemented Interfaces:
Serializable, TestSource
TestSource
with an optional position.- Since:
- 1.0
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic ClasspathResourceSourceCreate a newClasspathResourceSourceusing the supplied classpath resource name.static ClasspathResourceSourcefrom(String classpathResourceName, @Nullable FilePosition filePosition) Create a newClasspathResourceSourceusing the supplied classpath resource name andFilePosition.static ClasspathResourceSourceCreate a newClasspathResourceSourcefrom the suppliedURI.Get the name of the source classpath resource.Get theFilePosition, if available.inthashCode()toString()
-
Field Details
-
CLASSPATH_SCHEME
-
-
Method Details
-
from
Create a newClasspathResourceSourceusing the supplied classpath resource name.The name of a classpath resource must follow the semantics for resource paths as defined in
ClassLoader.getResource(String).If the supplied classpath resource name is prefixed with a slash (
/), the slash will be removed.- Parameters:
classpathResourceName- the name of the classpath resource; nevernullor blank- See Also:
-
from
public static ClasspathResourceSource from(String classpathResourceName, @Nullable FilePosition filePosition) Create a newClasspathResourceSourceusing the supplied classpath resource name andFilePosition.The name of a classpath resource must follow the semantics for resource paths as defined in
ClassLoader.getResource(String).If the supplied classpath resource name is prefixed with a slash (
/), the slash will be removed.- Parameters:
classpathResourceName- the name of the classpath resource; nevernullor blankfilePosition- the position in the classpath resource; may benull
-
from
Create a newClasspathResourceSourcefrom the suppliedURI.The
pathcomponent of theURI(excluding the query) will be used as the classpath resource name. The query component of theURI, if present, will be used to retrieve theFilePositionviaFilePosition.fromQuery(String).- Parameters:
uri- theURIfor the classpath resource; nevernull- Returns:
- a new
ClasspathResourceSource; nevernull - Throws:
org.junit.platform.commons.PreconditionViolationException- if the suppliedURIisnullor if the scheme of the suppliedURIis not equal to theCLASSPATH_SCHEME- Since:
- 1.3
- See Also:
-
getClasspathResourceName
Get the name of the source classpath resource.The name of a classpath resource follows the semantics for resource paths as defined in
ClassLoader.getResource(String).- See Also:
-
getPosition
Get theFilePosition, if available. -
equals
-
hashCode
-
toString
-