public class StringRegularExpression extends TypeSafeDiagnosingMatcher<String>
| Modifier | Constructor and Description |
|---|---|
protected |
StringRegularExpression(Pattern pattern) |
| Modifier and Type | Method and Description |
|---|---|
void |
describeTo(Description description)
Generates a description of the object.
|
static Matcher<String> |
matchesRegex(Pattern pattern)
Creates a matcher that checks if the examined string matches a specified
Pattern. |
static Matcher<String> |
matchesRegex(String regex)
Creates a matcher that checks if the examined string matches a specified regex.
|
protected boolean |
matchesSafely(String actual,
Description mismatchDescription)
Subclasses should implement this.
|
describeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringprotected StringRegularExpression(Pattern pattern)
public void describeTo(Description description)
SelfDescribingdescription - The description to be built or appended to.protected boolean matchesSafely(String actual, Description mismatchDescription)
TypeSafeDiagnosingMatchermatchesSafely in class TypeSafeDiagnosingMatcher<String>public static Matcher<String> matchesRegex(Pattern pattern)
Pattern.
assertThat("abc", matchesRegex(Pattern.compile("ˆ[a-z]$"));
pattern - the pattern to be used.Copyright © 2021. All rights reserved.