Class ClassSource
java.lang.Object
org.junit.platform.engine.support.descriptor.ClassSource
- All Implemented Interfaces:
Serializable,TestSource
Class based
TestSource with
an optional file position.
If a Java Class reference is provided, the ClassSource
will contain that Class and its class name accordingly. If a class
name is provided, the ClassSource will contain the class name and
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final FilePositionprivate Class<?> private static final long -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateClassSource(Class<?> javaClass) privateClassSource(Class<?> javaClass, FilePosition filePosition) privateClassSource(String className) privateClassSource(String className, FilePosition filePosition) -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic ClassSourceCreate a newClassSourceusing the supplied class.static ClassSourcefrom(Class<?> javaClass, FilePosition filePosition) static ClassSourceCreate a newClassSourceusing the supplied class name.static ClassSourcefrom(String className, FilePosition filePosition) Create a newClassSourceusing the supplied class name and file position.final StringGet the class name of this source.final Class<?> Get the Java class of this source.final Optional<FilePosition> inthashCode()toString()
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
className
-
filePosition
-
javaClass
-
-
Constructor Details
-
ClassSource
-
ClassSource
-
ClassSource
-
ClassSource
-
-
Method Details
-
from
Create a newClassSourceusing the supplied class name.- Parameters:
className- the class name; must not benullor blank
-
from
Create a newClassSourceusing the supplied class name and file position.- Parameters:
className- the class name; must not benullor blankfilePosition- the position in the source file; may benull
-
from
Create a newClassSourceusing the supplied class.- Parameters:
javaClass- the Java class; must not benull
-
from
- Parameters:
javaClass- the Java class; must not benullfilePosition- the position in the Java source file; may benull
-
getClassName
Get the class name of this source.- See Also:
-
getJavaClass
Get the Java class of this source.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.- See Also:
-
getPosition
- See Also:
-
equals
-
hashCode
public int hashCode() -
toString
-