org.assertj.swing.util
Class StringTextMatcher

java.lang.Object
  extended by org.assertj.swing.util.StringTextMatcher
All Implemented Interfaces:
TextMatcher

public class StringTextMatcher
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

Constructor Summary
StringTextMatcher(String... values)
          Creates a new StringTextMatcher.
 
Method Summary
 String description()
           
 String formattedValues()
           
 boolean isMatching(String text)
          Indicates whether the given text matches the String values in this matcher.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringTextMatcher

public StringTextMatcher(@Nonnull
                         String... values)
Creates a new StringTextMatcher.

Parameters:
values - the String values to match. Each value can be a regular expression.
Throws:
NullPointerException - if the array of values is null.
IllegalArgumentException - if the array of values is empty.
Method Detail

isMatching

public boolean isMatching(@Nullable
                          String text)
Indicates whether the given text matches the String values in this matcher. Each value can be a regular expression.

Specified by:
isMatching in interface TextMatcher
Parameters:
text - the text to verify.
Returns:
true if the given text matches the String values in this matcher, false otherwise.

description

@Nonnull
public String description()
Specified by:
description in interface TextMatcher
Returns:
"value" if this matcher contains only one value, or "values" if this matcher contains more than one value.

formattedValues

@Nonnull
public String formattedValues()
Specified by:
formattedValues in interface TextMatcher
Returns:
the String values in this matcher, formatted as a single String.


Copyright © 2014–2015 AssertJ. All rights reserved.