public class PatternTestSelector extends Object implements TestSelector
TestDescription will match if this selector's class-part is a substring of the TestDescription's full class-name, or if this selector's class-name, when interpreted as a
java.util.regex regular-expression, matches the TestDescription's full class-name.
(The same rules apply for the method-name as well. If this selector's class-part or method-part are null, all class-names or method-names will match.)
| Modifier and Type | Method and Description |
|---|---|
static TestSelector |
buildFromSelectorString(String rawSelectorString)
Build a
PatternTestSelector from the given String. |
boolean |
containsClassPath(String classPath) |
String |
getExplanation() |
String |
getRawSelector() |
boolean |
isInclusive() |
boolean |
isMatchAnyClass() |
boolean |
isMatchAnyMethod() |
boolean |
matches(TestDescription description)
Whether this
TestSelector matches the given TestDescription. |
boolean |
matchesClassName(String className) |
public static TestSelector buildFromSelectorString(String rawSelectorString)
PatternTestSelector from the given String. Selector strings should be of the
form "[is-exclusive][class-part]#[method-part]". If "[is-exclusive]" is a "!" then this
selector will exclude tests, otherwise it will include tests.
If the class-part (or method-part) are omitted, then all classes or methods will match. Consequently "#" means "include everything" and "!#" means "exclude everything".
If the selector string doesn't contain a "#" at all, it is interpreted as a class-part.
rawSelectorString - An unparsed selector string.public String getRawSelector()
getRawSelector in interface TestSelectorpublic String getExplanation()
getExplanation in interface TestSelectorpublic boolean isInclusive()
isInclusive in interface TestSelectorpublic boolean isMatchAnyClass()
isMatchAnyClass in interface TestSelectorpublic boolean isMatchAnyMethod()
isMatchAnyMethod in interface TestSelectorpublic boolean matches(TestDescription description)
TestSelectorTestSelector matches the given TestDescription. A class or method
name being null in the TestDescription means that it will match anything.matches in interface TestSelectordescription - the TestDescription to matchTestDescriptionpublic boolean matchesClassName(String className)
matchesClassName in interface TestSelectorpublic boolean containsClassPath(String classPath)
containsClassPath in interface TestSelector