@InternalApi public class JLabelDriver extends JComponentDriver implements TextDisplayDriver<JLabel>
Supports functional testing of JLabel
s.
Note: This class is intended for internal use only. Please use the classes in the package
org.assertj.swing.fixture
in your tests.
robot
Constructor and Description |
---|
JLabelDriver(Robot robot)
Creates a new
JLabelDriver . |
Modifier and Type | Method and Description |
---|---|
void |
requireText(JLabel label,
Pattern pattern)
Asserts that the text of the
JLabel matches the given regular expression pattern. |
void |
requireText(JLabel label,
String expected)
Asserts that the text of the
JLabel is equal to the specified String . |
String |
textOf(JLabel label)
Returns the text of the given
JLabel . |
clientProperty, invokeAction, isVisible, isVisible, requireToolTip, requireToolTip, scrollToVisible
doResizeHeight, doResizeWidth, isResizable, move, resize
backgroundOf, checkClickAllowed, checkInEdtEnabledAndShowing, checkInEdtShowing, click, click, click, click, click, doubleClick, drag, dragOver, drop, drop, focus, focusAndWaitForFocusGain, fontOf, foregroundOf, invokePopupMenu, invokePopupMenu, moveMouseIgnoringAnyError, moveMouseIgnoringAnyError, performAccessibleActionOf, pressAndReleaseKey, pressAndReleaseKey, pressAndReleaseKeys, pressKey, pressKeyWhileRunning, propertyName, releaseKey, requireDisabled, requireEnabled, requireEnabled, requireFocused, requireNotVisible, requireSize, requireVisible, rightClick, settings, waitForShowing
public JLabelDriver(@Nonnull Robot robot)
JLabelDriver
.robot
- the robot to use to simulate user input.@RunsInEDT public void requireText(@Nonnull JLabel label, @Nullable String expected)
JLabel
is equal to the specified String
.requireText
in interface TextDisplayDriver<JLabel>
label
- the target JLabel
.expected
- the text to match.AssertionError
- if the text of the JLabel
is not equal to the given one.@RunsInEDT public void requireText(@Nonnull JLabel label, @Nonnull Pattern pattern)
JLabel
matches the given regular expression pattern.requireText
in interface TextDisplayDriver<JLabel>
label
- the target JLabel
.pattern
- the regular expression pattern to match.AssertionError
- if the text of the JLabel
does not match the given regular expression pattern.NullPointerException
- if the given regular expression pattern is null
.@RunsInEDT @Nullable public String textOf(@Nonnull JLabel label)
JLabel
.textOf
in interface TextDisplayDriver<JLabel>
label
- the given JLabel
.JLabel
.Copyright © 2014–2019 AssertJ. All rights reserved.