Package org.junit.platform.engine
Class TestTag
- java.lang.Object
-
- org.junit.platform.engine.TestTag
-
- All Implemented Interfaces:
java.io.Serializable
@API(status=STABLE, since="1.0") public final class TestTag extends java.lang.Object implements java.io.SerializableImmutable value object for a tag that is assigned to a test or container.- Since:
- 1.0
- See Also:
isValid(String),create(String), Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Set<java.lang.String>RESERVED_CHARACTERSReserved characters that are not permissible as part of a tag name.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TestTagcreate(java.lang.String name)Create aTestTagfrom the suppliedname.booleanequals(java.lang.Object obj)java.lang.StringgetName()Get the name of this tag.inthashCode()static booleanisValid(java.lang.String name)Determine if the supplied tag name is valid with regard to the supported syntax for tags.java.lang.StringtoString()
-
-
-
Method Detail
-
isValid
public static boolean isValid(java.lang.String name)
Determine if the supplied tag name is valid with regard to the supported syntax for tags.Syntax Rules for Tags
- A tag must not be
null. - A tag must not be blank.
- A trimmed tag must not contain whitespace.
- A trimmed tag must not contain ISO control characters.
- A trimmed tag must not contain reserved characters.
If this method returns
truefor a given name, it is then a valid candidate for thecreate()factory method.- Parameters:
name- the name of the tag to validate; may benullor blank- Returns:
trueif the supplied tag name conforms to the supported syntax for tags- See Also:
StringUtils.isNotBlank(String),String.trim(),StringUtils.doesNotContainWhitespace(String),StringUtils.doesNotContainIsoControlCharacter(String),RESERVED_CHARACTERS,create(String)
- A tag must not be
-
create
public static TestTag create(java.lang.String name) throws org.junit.platform.commons.PreconditionViolationException
Create aTestTagfrom the suppliedname.Consider checking whether the syntax of the supplied
nameis valid before attempting to create aTestTagusing this factory method.Note: the supplied
namewill be trimmed.- Parameters:
name- the name of the tag; must be syntactically valid- Throws:
org.junit.platform.commons.PreconditionViolationException- if the supplied tag name is not syntactically valid- See Also:
isValid(String)
-
getName
public java.lang.String getName()
Get the name of this tag.- Returns:
- the name of this tag; never
nullor blank
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-