@API(status=STABLE, since="1.0") public final class TestIdentifier extends Object implements Serializable
TestPlan
.TestPlan
,
Serialized FormModifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
static TestIdentifier |
from(TestDescriptor testDescriptor)
Factory for creating a new
TestIdentifier from a TestDescriptor . |
String |
getDisplayName()
Get the display name of the represented test or container.
|
String |
getLegacyReportingName()
Get the name of this identifier in a format that is suitable for legacy
reporting infrastructure — for example, for reporting systems built
on the Ant-based XML reporting format for JUnit 4.
|
Optional<String> |
getParentId()
Get the unique ID of this identifier's parent, if available.
|
Optional<TestSource> |
getSource()
Get the source of the represented test
or container, if available.
|
Set<TestTag> |
getTags()
Get the set of tags associated with the represented
test or container.
|
TestDescriptor.Type |
getType()
Get the underlying descriptor type.
|
String |
getUniqueId()
Get the unique ID of the represented test or container.
|
int |
hashCode() |
boolean |
isContainer()
Determine if this identifier represents a container.
|
boolean |
isTest()
Determine if this identifier represents a test.
|
String |
toString() |
@API(status=INTERNAL, since="1.0") public static TestIdentifier from(TestDescriptor testDescriptor)
TestIdentifier
from a TestDescriptor
.public String getUniqueId()
Uniqueness must be guaranteed across an entire test plan, regardless of how many engines are used behind the scenes.
null
public Optional<String> getParentId()
An identifier without a parent is called a root.
null
though potentially emptypublic 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()
,
TestDescriptor.getDisplayName()
public String getLegacyReportingName()
The default implementation simply delegates to getDisplayName()
.
null
or blankTestDescriptor.getLegacyReportingName()
public TestDescriptor.Type getType()
null
public boolean isTest()
true
if the underlying descriptor type represents a test,
false
otherwiseTestDescriptor.Type.isTest()
public boolean isContainer()
true
if the underlying descriptor type represents a container,
false
otherwiseTestDescriptor.Type.isContainer()
public Optional<TestSource> getSource()
TestSource
public Set<TestTag> getTags()
TestTag