@API(status=STABLE,
since="1.0")
public final class TestIdentifier
extends java.lang.Object
implements java.io.Serializable
TestPlan
.TestPlan
,
Serialized FormModifier and Type | Field and Description |
---|---|
private java.lang.String |
displayName |
private java.lang.String |
legacyReportingName |
private java.lang.String |
parentId |
private static long |
serialVersionUID |
private TestSource |
source |
private java.util.Set<TestTag> |
tags |
private TestDescriptor.Type |
type |
private java.lang.String |
uniqueId |
Constructor and Description |
---|
TestIdentifier(java.lang.String uniqueId,
java.lang.String displayName,
TestSource source,
java.util.Set<TestTag> tags,
TestDescriptor.Type type,
java.lang.String parentId,
java.lang.String legacyReportingName) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
static TestIdentifier |
from(TestDescriptor testDescriptor)
Factory for creating a new
TestIdentifier from a TestDescriptor . |
java.lang.String |
getDisplayName()
Get the display name of the represented test or container.
|
java.lang.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.
|
java.util.Optional<java.lang.String> |
getParentId()
Get the unique ID of this identifier's parent, if available.
|
java.util.Optional<TestSource> |
getSource()
Get the source of the represented test
or container, if available.
|
java.util.Set<TestTag> |
getTags()
Get the set of tags associated with the represented
test or container.
|
TestDescriptor.Type |
getType()
Get the underlying descriptor type.
|
java.lang.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.
|
java.lang.String |
toString() |
private static final long serialVersionUID
private final java.lang.String uniqueId
private final java.lang.String parentId
private final java.lang.String displayName
private final java.lang.String legacyReportingName
private final TestSource source
private final java.util.Set<TestTag> tags
private final TestDescriptor.Type type
TestIdentifier(java.lang.String uniqueId, java.lang.String displayName, TestSource source, java.util.Set<TestTag> tags, TestDescriptor.Type type, java.lang.String parentId, java.lang.String legacyReportingName)
@API(status=INTERNAL, since="1.0") public static TestIdentifier from(TestDescriptor testDescriptor)
TestIdentifier
from a TestDescriptor
.public java.lang.String getUniqueId()
Uniqueness must be guaranteed across an entire test plan, regardless of how many engines are used behind the scenes.
null
public java.util.Optional<java.lang.String> getParentId()
An identifier without a parent is called a root.
null
though potentially emptypublic 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()
,
TestDescriptor.getDisplayName()
public java.lang.String getLegacyReportingName()
The default implementation simply delegates to getDisplayName()
.
null
or blankTestDescriptor.getLegacyReportingName()
,
LegacyReportingUtils
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 java.util.Optional<TestSource> getSource()
TestSource
public java.util.Set<TestTag> getTags()
TestTag
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object