GeezerVison is showing docs.junit.org — UniqueId (JUnit 6.1.2 API)
Class UniqueId
- All Implemented Interfaces:
Serializable, Cloneable
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 Classes
Modifier and Type
Class
Description
static final class
A segment of a UniqueId comprises a type and a
value.
-
Method Summary
Modifier and Type
Method
Description
Construct a new UniqueId by appending a new UniqueId.Segment, based
on the supplied segmentType and value, to the end of this
UniqueId.
Construct a new UniqueId by appending a new UniqueId.Segment to
the end of this UniqueId.
Construct a new UniqueId by appending a new UniqueId.Segment, based
on the supplied engineId, to the end of this UniqueId.
boolean
Create an engine's unique ID from its engineId using the default
format.
Get the engine ID stored in this UniqueId, if available.
Get the immutable list of segments that make up this
UniqueId.
int
boolean
Determine if the supplied UniqueId is a prefix for this
UniqueId.
Parse a UniqueId from the supplied string representation using the
default format.
Construct a new UniqueId and removing the last UniqueId.Segment of
this UniqueId.
Create a root unique ID from the supplied segmentType and
value using the default format.
Generate the unique, formatted string representation of this UniqueId
using the configured UniqueIdFormat.
-
Method Details
-
parse
Parse a UniqueId from the supplied string representation using the
default format.
- Parameters:
uniqueId - the string representation to parse; never null or blank
- Returns:
- a properly constructed
UniqueId
- Throws:
JUnitException - if the string cannot be parsed
-
forEngine
Create an engine's unique ID from its engineId using the default
format.
The engine ID will be stored in a UniqueId.Segment with
type "engine".
- Parameters:
engineId - the engine ID; never null or blank
- See Also:
-
-
root
Create a root unique ID from the supplied segmentType and
value using the default format.
- Parameters:
segmentType - the segment type; never null or blank
value - the value; never null or blank
- See Also:
-
-
getEngineId
Get the engine ID stored in this UniqueId, if available.
- See Also:
-
-
getSegments
Get the immutable list of segments that make up this
UniqueId.
-
append
Construct a new UniqueId by appending a new UniqueId.Segment, based
on the supplied segmentType and value, to the end of this
UniqueId.
This UniqueId will not be modified.
Neither the segmentType nor the value may contain any
of the special characters used for constructing the string representation
of this UniqueId.
- Parameters:
segmentType - the type of the segment; never null or blank
value - the value of the segment; never null or blank
-
append
Construct a new UniqueId by appending a new UniqueId.Segment to
the end of this UniqueId.
This UniqueId will not be modified.
- Parameters:
segment - the segment to be appended; never null
- Since:
- 1.1
-
appendEngine
Construct a new UniqueId by appending a new UniqueId.Segment, based
on the supplied engineId, to the end of this UniqueId.
This UniqueId will not be modified.
The engine ID will be stored in a UniqueId.Segment with
type "engine".
- Parameters:
engineId - the engine ID; never null or blank
- Since:
- 1.8
- See Also:
-
-
hasPrefix
Determine if the supplied UniqueId is a prefix for this
UniqueId.
- Parameters:
potentialPrefix - the UniqueId to be checked; never null
- Since:
- 1.1
-
removeLastSegment
Construct a new UniqueId and removing the last UniqueId.Segment of
this UniqueId.
This UniqueId will not be modified.
- Returns:
- a new
UniqueId; never null
- Throws:
PreconditionViolationException - if this UniqueId contains a single segment
- Since:
- 1.5
-
getLastSegment
- Returns:
- the last
Segment; never null
- Since:
- 1.5
-
-
-
-
toString
Generate the unique, formatted string representation of this UniqueId
using the configured UniqueIdFormat.
- Overrides:
toString in class Object
|