@API(value=Experimental) public abstract class AbstractTestDescriptor extends java.lang.Object implements TestDescriptor
TestDescriptor that may be used by
custom TestEngines.
Subclasses should call setSource(org.junit.platform.engine.TestSource) in their constructor, if
possible, and override getTags(), if appropriate.
TestDescriptor.Visitor| Modifier | Constructor and Description |
|---|---|
protected |
AbstractTestDescriptor(UniqueId uniqueId,
java.lang.String displayName)
Create a new
AbstractTestDescriptor with the supplied
UniqueId and display name. |
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(TestDescriptor child)
Add a child to this descriptor.
|
boolean |
equals(java.lang.Object other) |
java.util.Optional<? extends TestDescriptor> |
findByUniqueId(UniqueId uniqueId)
Find the descriptor with the supplied unique ID.
|
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.
|
int |
hashCode() |
void |
removeChild(TestDescriptor child)
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.
|
protected void |
setSource(TestSource source) |
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitaccept, getAllDescendants, hasTests, isContainer, isRoot, isTestprotected AbstractTestDescriptor(UniqueId uniqueId, java.lang.String displayName)
AbstractTestDescriptor with the supplied
UniqueId and display name.uniqueId - the unique ID of this TestDescriptor; never
nulldisplayName - the display name for this TestDescriptor;
never null or blankpublic final UniqueId getUniqueId()
TestDescriptorUniqueness must be guaranteed across an entire test plan, regardless of how many engines are used behind the scenes.
getUniqueId in interface TestDescriptorUniqueId for this descriptor; never nullpublic final java.lang.String getDisplayName()
TestDescriptorA 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.
getDisplayName in interface TestDescriptornull or blankTestDescriptor.getSource()public java.util.Optional<TestDescriptor> getParent()
TestDescriptorgetParent in interface TestDescriptorpublic final void setParent(TestDescriptor parent)
TestDescriptorsetParent in interface TestDescriptorparent - the new parent of this descriptor; may be null.public void removeChild(TestDescriptor child)
TestDescriptorremoveChild in interface TestDescriptorchild - the child to remove from this descriptor; never
nullpublic void removeFromHierarchy()
TestDescriptorIf this method is invoked on a root descriptor,
this method must throw a JUnitException explaining that a root cannot be removed from the
hierarchy.
removeFromHierarchy in interface TestDescriptorpublic java.util.Optional<? extends TestDescriptor> findByUniqueId(UniqueId uniqueId)
TestDescriptorThe search algorithm begins with this descriptor and then searches through its descendants.
findByUniqueId in interface TestDescriptoruniqueId - the UniqueId to search for; never nullpublic void addChild(TestDescriptor child)
TestDescriptoraddChild in interface TestDescriptorchild - the child to add to this descriptor; never nullpublic final java.util.Set<? extends TestDescriptor> getChildren()
TestDescriptorgetChildren in interface TestDescriptornull
but potentially emptyTestDescriptor.getAllDescendants()protected final void setSource(TestSource source)
public java.util.Set<TestTag> getTags()
TestDescriptorgetTags in interface TestDescriptornull
but potentially emptyTestTagpublic java.util.Optional<TestSource> getSource()
TestDescriptorgetSource in interface TestDescriptorTestSourcepublic final int hashCode()
hashCode in class java.lang.Objectpublic final boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object