public final class JTextComponentMatcher extends NamedComponentMatcherTemplate<JTextComponent>
JTextComponent by type, name or text.ANY, name| Modifier and Type | Method and Description |
|---|---|
JTextComponentMatcher |
andShowing()
Indicates that the
to match should be showing on the screen. |
JTextComponentMatcher |
andText(Pattern textPattern)
Specifies the text to match.
|
JTextComponentMatcher |
andText(String newText)
Specifies the text to match.
|
static JTextComponentMatcher |
any()
Creates a new
that matches any . |
protected boolean |
isMatching(JTextComponent button)
Indicates whether the text of the given
is equal to the text in this matcher. |
String |
toString() |
static JTextComponentMatcher |
withName(String name)
Creates a new
that matches a that:
has a matching name
(optionally) has matching text
(optionally) is showing on the screen |
static JTextComponentMatcher |
withText(Pattern textPattern)
Creates a new
that matches a by its
text. |
static JTextComponentMatcher |
withText(String text)
Creates a new
that matches a by its
text. |
arePropertyValuesMatching, isNameMatching, quoted, quotedNamematches, supportedTyperequireShowing, requireShowing, requireShowingMatches, resetpublic static JTextComponentMatcher withName(String name)
JTextComponentMatcher that matches a JTextComponent that:
The following code listing shows how to match a by name and text:
JTextComponent
JTextComponentMatcher m =withName("lastName").andText("Wang");
The following code listing shows how to match a , that should be showing on the screen,
by name and text:
JTextComponent
JTextComponentMatcher m =withName("lastName").andText("Wang").andShowing();
name - the id to match.public static JTextComponentMatcher withText(String text)
JTextComponentMatcher that matches a JTextComponent by its
text.
The following code listing shows how to match a by text:
JTextComponent
JTextComponentMatcher m = withText("Wang");
The following code listing shows how to match a , that should be showing on the
screen, by text:
JTextComponent
JTextComponentMatcher m =withText("Wang").andShowing();
text - the text to match. It can be a regular expression.public static JTextComponentMatcher withText(Pattern textPattern)
JTextComponentMatcher that matches a JTextComponent by its
text.
The following code listing shows how to match a by text, using a regular
expression pattern:
JTextComponent
JTextComponentMatcher m = withText(Pattern.compile("W.*"));
The following code listing shows how to match a , that should be showing on the
screen, by text, using a regular expression pattern:
JTextComponent
JTextComponentMatcher m =withText(Pattern.compile("W.*")).andShowing();
textPattern - the text to match. It can be a regular expression.public static JTextComponentMatcher any()
JTextComponentMatcher that matches any JTextComponent.public JTextComponentMatcher andText(String newText)
withText(String) or
withText(Pattern), this method will simply update the text to match.newText - the new text to match. It can be a regular expression.public JTextComponentMatcher andText(Pattern textPattern)
withText(String) or
withText(Pattern), this method will simply update the text to match.textPattern - the regular expression pattern to match.public JTextComponentMatcher andShowing()
JTextComponent to match should be showing on the screen.@RunsInCurrentThread protected boolean isMatching(JTextComponent button)
JTextComponent is equal to the text in this matcher.
Note: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.
isMatching in class GenericTypeMatcher<JTextComponent>button - the JTextComponent to match.true if the text in the JTextComponent is equal to the text in this matcher,
false otherwise.Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.