Package org.junit.platform.launcher
Class TestIdentifier
java.lang.Object
org.junit.platform.launcher.TestIdentifier
- All Implemented Interfaces:
Serializable
@API(status=STABLE,
since="1.0")
public final class TestIdentifier
extends Object
implements Serializable
Immutable data transfer object that represents a test or container which is
usually part of a
TestPlan.- Since:
- 1.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final Stringprivate final Stringprivate static final longprivate final TestSourceprivate final TestDescriptor.Typeprivate final String -
Constructor Summary
ConstructorsConstructorDescriptionTestIdentifier(String uniqueId, String displayName, TestSource source, Set<TestTag> tags, TestDescriptor.Type type, String parentId, String legacyReportingName) -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic TestIdentifierfrom(TestDescriptor testDescriptor) Factory for creating a newTestIdentifierfrom aTestDescriptor.Get the display name of the represented test or container.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.Get the unique ID of this identifier's parent, if available.Get the source of the represented test or container, if available.getTags()Get the set of tags associated with the represented test or container.getType()Get the underlying descriptor type.Get the unique ID of the represented test or container.inthashCode()booleanDetermine if this identifier represents a container.booleanisTest()Determine if this identifier represents a test.toString()
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
uniqueId
-
parentId
-
displayName
-
legacyReportingName
-
source
-
tags
-
type
-
-
Constructor Details
-
TestIdentifier
TestIdentifier(String uniqueId, String displayName, TestSource source, Set<TestTag> tags, TestDescriptor.Type type, String parentId, String legacyReportingName)
-
-
Method Details
-
from
Factory for creating a newTestIdentifierfrom aTestDescriptor. -
getUniqueId
Get the unique ID of the represented test or container.Uniqueness must be guaranteed across an entire test plan, regardless of how many engines are used behind the scenes.
- Returns:
- the unique ID for this identifier; never
null
-
getParentId
Get the unique ID of this identifier's parent, if available.An identifier without a parent is called a root.
- Returns:
- a container for the unique ID for this identifier's parent;
never
nullthough potentially empty
-
getDisplayName
Get the display name of the represented test or container.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
TestEnginesor potentially by end users as well. Consequently, display names should never be parsed; rather, they should be used for display purposes only.- Returns:
- the display name for this identifier; never
nullor blank - See Also:
-
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.The default implementation simply delegates to
getDisplayName().- Returns:
- the legacy reporting name; never
nullor blank - See Also:
-
getType
Get the underlying descriptor type.- Returns:
- the underlying descriptor type; never
null
-
isTest
public boolean isTest()Determine if this identifier represents a test.- Returns:
trueif the underlying descriptor type represents a test,falseotherwise- See Also:
-
isContainer
public boolean isContainer()Determine if this identifier represents a container.- Returns:
trueif the underlying descriptor type represents a container,falseotherwise- See Also:
-
getSource
Get the source of the represented test or container, if available.- See Also:
-
getTags
Get the set of tags associated with the represented test or container.- See Also:
-
equals
-
hashCode
public int hashCode() -
toString
-