Class UniqueId
java.lang.Object
org.junit.platform.engine.UniqueId
- All Implemented Interfaces:
Serializable,Cloneable
@API(status=STABLE,
since="1.0")
public final class UniqueId
extends Object
implements Cloneable, Serializable
UniqueId encapsulates the creation, parsing, and display of unique IDs
for TestDescriptors.
Instances of this class have value semantics and are immutable.
- Since:
- 1.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA segment of aUniqueIdcomprises a type and a value. -
Method Summary
Modifier and TypeMethodDescriptionConstruct a newUniqueIdby appending a newUniqueId.Segment, based on the suppliedsegmentTypeandvalue, to the end of thisUniqueId.append(UniqueId.Segment segment) appendEngine(String engineId) Construct a newUniqueIdby appending a newUniqueId.Segment, based on the suppliedengineId, to the end of thisUniqueId.protected Objectclone()booleanstatic UniqueIdCreate an engine's unique ID from itsengineIdusing the default format.Get the engine ID stored in thisUniqueId, if available.Get the lastUniqueId.Segmentof thisUniqueId.Get the immutable list of segments that make up thisUniqueId.inthashCode()booleanDetermine if the suppliedUniqueIdis a prefix for thisUniqueId.static UniqueIdParse aUniqueIdfrom the supplied string representation using the default format.static UniqueIdCreate a root unique ID from the suppliedsegmentTypeandvalueusing the default format.toString()Generate the unique, formatted string representation of thisUniqueIdusing the configuredUniqueIdFormat.
-
Method Details
-
parse
Parse aUniqueIdfrom the supplied string representation using the default format.- Parameters:
uniqueId- the string representation to parse; nevernullor blank- Returns:
- a properly constructed
UniqueId - Throws:
JUnitException- if the string cannot be parsed
-
forEngine
Create an engine's unique ID from itsengineIdusing the default format.The engine ID will be stored in a
UniqueId.Segmentwithtype"engine".- Parameters:
engineId- the engine ID; nevernullor blank- See Also:
-
root
-
getEngineId
-
getSegments
Get the immutable list of segments that make up thisUniqueId. -
append
Construct a newUniqueIdby appending a newUniqueId.Segment, based on the suppliedsegmentTypeandvalue, to the end of thisUniqueId.This
UniqueIdwill not be modified.Neither the
segmentTypenor thevaluemay contain any of the special characters used for constructing the string representation of thisUniqueId.- Parameters:
segmentType- the type of the segment; nevernullor blankvalue- the value of the segment; nevernullor blank
-
append
Construct a newUniqueIdby appending a newUniqueId.Segmentto the end of thisUniqueId.This
UniqueIdwill not be modified.- Parameters:
segment- the segment to be appended; nevernull- Since:
- 1.1
-
appendEngine
Construct a newUniqueIdby appending a newUniqueId.Segment, based on the suppliedengineId, to the end of thisUniqueId.This
UniqueIdwill not be modified.The engine ID will be stored in a
UniqueId.Segmentwithtype"engine".- Parameters:
engineId- the engine ID; nevernullor blank- Since:
- 1.8
-
hasPrefix
-
removeLastSegment
Construct a newUniqueIdand removing the lastUniqueId.Segmentof thisUniqueId.This
UniqueIdwill not be modified.- Returns:
- a new
UniqueId; nevernull - Throws:
PreconditionViolationException- if thisUniqueIdcontains a single segment- Since:
- 1.5
-
getLastSegment
Get the lastUniqueId.Segmentof thisUniqueId.- Returns:
- the last
Segment; nevernull - Since:
- 1.5
-
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
equals
-
hashCode
-
toString
-