public final class TaskDef
extends java.lang.Object
implements java.io.Serializable
Task from a test framework.
An array of TaskDef is passed to Runner's tasks method, which returns
an array of Tasks. Each returned task, when executed, will run tests and suites determined by the
test class name, fingerprints, "explicitly specified" field, and selectors of one of the passed TaskDefs.
The "Explicitly specified" field means the user supplied a complete fully qualified test name, such as with the command:
> test-only com.mycompany.myproject.WholeNameSpec
as opposed to commands like:
> test-only *WholeNameSpec
or simply:
> test
The explicitlySpecified field will be true for in the first case, and false in the last two cases, because only
in the first case was the fully qualified test class name completely specified by the user. The test framework can use this information
to decide whether to ignore an annotation requesting a class not be discovered.
The fingerprint parameter indicates how the test suite was identified as a test suite. This tasks
method may be called with TaskDefs containing the same value for testClassName but different fingerprints.
For example, if both a class and its companion object were test classes, the tasks method could be passed an array containing
TaskDefs with the same name but with a different value for fingerprint.isModule.
A test framework may "reject" a requested task by returning no Task for that TaskDef.
| Constructor and Description |
|---|
TaskDef(java.lang.String fullyQualifiedName,
Fingerprint fingerprint,
boolean explicitlySpecified,
Selector[] selectors)
Constructs a new
TaskDef with the given fully qualified name, fingerprint, "explicitly specified" fag, and array
of selectors. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
boolean |
explicitlySpecified()
Indicates whether or not the test class requested by this
TaskDef was "explicitly specified." |
Fingerprint |
fingerprint()
The fingerprint that the test class requested by this
TaskDef matches. |
java.lang.String |
fullyQualifiedName()
The fully qualified name of the test class requested by this
TaskDef. |
int |
hashCode() |
Selector[] |
selectors()
One to many selectors describing the nature of the
Task requested by this TaskDef. |
java.lang.String |
toString() |
public TaskDef(java.lang.String fullyQualifiedName,
Fingerprint fingerprint,
boolean explicitlySpecified,
Selector[] selectors)
TaskDef with the given fully qualified name, fingerprint, "explicitly specified" fag, and array
of selectors.fullyQualifiedName - the fully qualified name of the test class to be run by the requested taskfingerprint - indicates how the test suite was identified as a test suite.explicitlySpecified - indicates whether the test class was explicitly specified by user.selectors - a possibly empty array of Selectors determining suites and tests to runpublic java.lang.String fullyQualifiedName()
TaskDef.public Fingerprint fingerprint()
TaskDef matches.public boolean explicitlySpecified()
TaskDef was "explicitly specified."
For more information on what explicitly specified means, see the main documentation for this class.
public Selector[] selectors()
Task requested by this TaskDef.
A Selector can indicate a direct, such as command-line, request from the user or a "rerun" of previously run tests.
In the latter case, the Selectors would be taken from those passed in events of a previous run or runs.
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object