org.assertj.swing.util
Class PatternTextMatcher
java.lang.Object
org.assertj.swing.util.PatternTextMatcher
- All Implemented Interfaces:
- TextMatcher
public class PatternTextMatcher
- extends Object
- implements TextMatcher
Matches text to a group of String
values. Matching is perform by equality or by regular expression matching.
- Author:
- Alex Ruiz
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PatternTextMatcher
public PatternTextMatcher(@Nonnull
Pattern... patterns)
- Creates a new
PatternTextMatcher
.
- Parameters:
patterns
- the regular expression patterns to match.
- Throws:
NullPointerException
- if the array of patterns is null
.
IllegalArgumentException
- if the array of patterns is empty.
isMatching
public boolean isMatching(@Nullable
String text)
- Indicates whether the given text matches the regular expression patterns in this matcher.
- Specified by:
isMatching
in interface TextMatcher
- Parameters:
text
- the text to verify.
- Returns:
true
if the given text matches the Pattern
values in this matcher, false
otherwise.
- Throws:
NullPointerException
- if any of the regular expressions is null
.
description
@Nonnull
public String description()
- Specified by:
description
in interface TextMatcher
- Returns:
- "pattern" if this matcher contains only one pattern, or "patterns" if this matcher contains more than one
pattern.
formattedValues
@Nonnull
public String formattedValues()
- Specified by:
formattedValues
in interface TextMatcher
- Returns:
- the regular expression patterns in this matcher, formatted as a single
String
.
Copyright © 2014–2015 AssertJ. All rights reserved.