public final class JLabelMatcher extends NamedComponentMatcherTemplate<JLabel>
JLabels by name, text or visibility on the screen.| Modifier and Type | Method and Description |
|---|---|
JLabelMatcher |
andShowing()
Indicates that the
JLabel to match should be showing on the screen. |
JLabelMatcher |
andText(Pattern textPattern)
Specifies the text to match.
|
JLabelMatcher |
andText(String newText)
Specifies the text to match.
|
static JLabelMatcher |
any()
Creates a new
JLabelMatcher that matches any JLabel. |
protected boolean |
isMatching(JLabel label)
Indicates whether the name and text of the given
JLabel match the ones in this matcher. |
String |
toString() |
static JLabelMatcher |
withName(String name)
Creates a new
JLabelMatcher that matches a JLabel by text. |
static JLabelMatcher |
withText(Pattern textPattern)
Creates a new
JLabelMatcher that matches a JLabel by text. |
static JLabelMatcher |
withText(String text)
Creates a new
JLabelMatcher that matches a JLabel by text. |
anyValue, arePropertyValuesMatching, isNameMatching, name, quoted, quotedNamematches, supportedTyperequireShowing, requireShowing, requireShowingMatches, reset@Nonnull public static JLabelMatcher withName(@Nullable String name)
Creates a new JLabelMatcher that matches a JLabel by text.
The following code listing shows how to match a JLabel by name and text:
JLabelMatcher m =withName("firstName").andText("First Name:");
The following code listing shows how to match a JLabel, that should be showing on the screen, by name and
text:
JLabelMatcher m =withName("firstName").andText("First Name:").andShowing();
name - the id to match.@Nonnull public static JLabelMatcher withText(@Nullable String text)
Creates a new JLabelMatcher that matches a JLabel by text.
The following code listing shows how to match a JLabel by text:
JLabelMatcher m = withText("First Name:");
The following code listing shows how to match a JLabel, that should be showing on the screen, by text:
JLabelMatcher m =withText("First Name:").andShowing();
text - the text to match. It can be a regular expression.@Nonnull public static JLabelMatcher withText(@Nonnull Pattern textPattern)
Creates a new JLabelMatcher that matches a JLabel by text.
The following code listing shows how to match a JLabel by text:
JLabelMatcher m = withText(Pattern.compile("F.*");
The following code listing shows how to match a JLabel, that should be showing on the screen, by text:
JLabelMatcher m =withText(Pattern.compile("F.*").andShowing();
textPattern - the regular expression pattern to match.@Nonnull public static JLabelMatcher any()
JLabelMatcher that matches any JLabel.@Nonnull public JLabelMatcher andText(@Nullable 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.@Nonnull public JLabelMatcher andText(@Nonnull Pattern textPattern)
withText(String) or
withText(Pattern), this method will simply update the text to match.textPattern - the regular expression pattern to match.public JLabelMatcher andShowing()
JLabel to match should be showing on the screen.@RunsInCurrentThread protected boolean isMatching(@Nonnull JLabel label)
Indicates whether the name and text of the given JLabel match the ones in this matcher.
Note: This method is accessed in the current executing thread. Such thread may or may not be the event dispatch thread (EDT.) Client code must call this method from the EDT.
isMatching in class GenericTypeMatcher<JLabel>label - the JLabel to match.true if the text in the JLabel is equal to the text in this matcher, false
otherwise.Copyright © 2014 AssertJ. All rights reserved.