public final class JButtonMatcher extends NamedComponentMatcherTemplate<JButton>
JButton
by name, text and visibility on the screen.ANY, name
Modifier and Type | Method and Description |
---|---|
JButtonMatcher |
andShowing()
Indicates that the
to match should be showing on the screen. |
JButtonMatcher |
andText(Pattern textPattern)
Specifies the text to match.
|
JButtonMatcher |
andText(String newText)
Specifies the text to match.
|
static JButtonMatcher |
any()
Creates a new
that matches any . |
protected boolean |
isMatching(JButton button)
Indicates whether:
the name of the given
JButton is equal to the name in this matcher, and
the text of the given JButton matches the text (or pattern) in this matcher
|
String |
toString() |
static JButtonMatcher |
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 JButtonMatcher |
withText(Pattern textPattern)
Creates a new
that matches a by its text. |
static JButtonMatcher |
withText(String text)
Creates a new
that matches a by its text. |
arePropertyValuesMatching, isNameMatching, quoted, quotedName
matches, supportedType
requireShowing, requireShowing, requireShowingMatches, reset
public static JButtonMatcher withName(String name)
JButtonMatcher
that matches a JButton
that:
The following code listing shows how to match a
by name and text:
JButton
JButtonMatcher m =withName
("ok").andText
("OK");
The following code listing shows how to match a
, that should be showing on the screen,
by name and text:
JButton
JButtonMatcher m =withName
("ok").andText
("OK").andShowing
();
name
- the name to match.public static JButtonMatcher withText(String text)
JButtonMatcher
that matches a JButton
by its text.
The following code listing shows how to match a
by text:
JButton
JButtonMatcher m = withText
("OK");
The following code listing shows how to match a
, that should be showing on the screen,
by text:
JButton
JButtonMatcher m =withText
("OK").andShowing
();
text
- the text to match. It can be a regular expression.public static JButtonMatcher withText(Pattern textPattern)
JButtonMatcher
that matches a JButton
by its text.
The following code listing shows how to match a
by text, using a regular expression
pattern:
JButton
JButtonMatcher m = withText
(Pattern.compile("O.*"));
The following code listing shows how to match a
, that should be showing on the screen,
by text, using a regular expression pattern:
JButton
JButtonMatcher m =withText
(Pattern.compile("O.*")).andShowing
();
textPattern
- the regular expression pattern to match.public static JButtonMatcher any()
JButtonMatcher
that matches any JButton
.public JButtonMatcher 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 JButtonMatcher 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 JButtonMatcher andShowing()
JButton
to match should be showing on the screen.@RunsInCurrentThread protected boolean isMatching(JButton button)
JButton
is equal to the name in this matcher, andJButton
matches the text (or pattern) in this matcherNote: 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<JButton>
button
- the JButton
to match.true
if the JButton
matches the search criteria in this matcher.Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.