org.fest.swing.util
Class StringTextMatcher

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

public class StringTextMatcher
extends Object
implements TextMatcher

Understands matching 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()
          Returns "value" if this matcher contains only one value, or "values" if this matcher contains more than one value.
 String formattedValues()
          Returns the String values in this matcher, formatted as a single String.
 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(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(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

public String description()
Returns "value" if this matcher contains only one value, or "values" if this matcher contains more than one value.

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

public String formattedValues()
Returns the String values in this matcher, formatted as a single String.

Specified by:
formattedValues in interface TextMatcher
Returns:
the String values in this matcher, formatted as a single String.


Copyright © 2007-2011 FEST (Fixtures for Easy Software Testing). All Rights Reserved.