@API(value=Experimental) public interface TestDescriptor
TestEngine
.TestEngine
Modifier and Type | Interface and Description |
---|---|
static interface |
TestDescriptor.Visitor
Visitor for the tree-like
TestDescriptor structure. |
Modifier and Type | Method and Description |
---|---|
default void |
accept(TestDescriptor.Visitor visitor)
Accept a visitor to the subtree starting with this descriptor.
|
void |
addChild(TestDescriptor descriptor)
Add a child to this descriptor.
|
java.util.Optional<? extends TestDescriptor> |
findByUniqueId(UniqueId uniqueId)
Find the descriptor with the supplied unique ID.
|
default java.util.Set<? extends TestDescriptor> |
getAllDescendants()
Get the set of all descendants of this descriptor.
|
java.util.Set<? extends TestDescriptor> |
getChildren()
Get the set of children of this descriptor.
|
java.lang.String |
getDisplayName()
Get the display name for this descriptor.
|
java.util.Optional<TestDescriptor> |
getParent()
Get the parent of this descriptor, if available.
|
java.util.Optional<TestSource> |
getSource()
Get the source of the test or container described
by this descriptor, if available.
|
java.util.Set<TestTag> |
getTags()
Get the set of tags associated with this descriptor.
|
UniqueId |
getUniqueId()
Get the unique identifier (UID) for this descriptor.
|
default boolean |
hasTests()
Determine if this descriptor or any of its descendants describes a test.
|
boolean |
isContainer()
Determine if this descriptor describes a container.
|
default boolean |
isRoot()
Determine if this descriptor is a root descriptor.
|
boolean |
isTest()
Determine if this descriptor describes a test.
|
void |
removeChild(TestDescriptor descriptor)
Remove a child from this descriptor.
|
void |
removeFromHierarchy()
Remove this non-root descriptor from its parent and remove all the
children from this descriptor.
|
void |
setParent(TestDescriptor parent)
Set the parent of this descriptor.
|
UniqueId getUniqueId()
Uniqueness must be guaranteed across an entire test plan, regardless of how many engines are used behind the scenes.
UniqueId
for this descriptor; never null
java.lang.String getDisplayName()
A display name is a human-readable name for a test or
container that is typically used for test reporting in IDEs and build
tools. Display names may contain spaces, special characters, and emoji,
and the format may be customized by TestEngines
or
potentially by end users as well. Consequently, display names should
never be parsed; rather, they should be used for display purposes only.
null
or blankgetSource()
java.util.Set<TestTag> getTags()
null
but potentially emptyTestTag
java.util.Optional<TestSource> getSource()
TestSource
java.util.Optional<TestDescriptor> getParent()
void setParent(TestDescriptor parent)
parent
- the new parent of this descriptor; may be null
.java.util.Set<? extends TestDescriptor> getChildren()
null
but potentially emptygetAllDescendants()
default java.util.Set<? extends TestDescriptor> getAllDescendants()
A descendant is a child of this descriptor or a child of one of its children, recursively.
getChildren()
void addChild(TestDescriptor descriptor)
descriptor
- the child to add to this descriptor; never null
void removeChild(TestDescriptor descriptor)
descriptor
- the child to remove from this descriptor; never
null
void removeFromHierarchy()
If this method is invoked on a root descriptor,
this method must throw a JUnitException
explaining that a root cannot be removed from the
hierarchy.
default boolean isRoot()
A root descriptor is a descriptor without a parent.
boolean isContainer()
boolean isTest()
default boolean hasTests()
java.util.Optional<? extends TestDescriptor> findByUniqueId(UniqueId uniqueId)
The search algorithm begins with this descriptor and then searches through its descendants.
uniqueId
- the UniqueId
to search for; never null
default void accept(TestDescriptor.Visitor visitor)
visitor
- the Visitor
to accept; never null