@InternalApi public class AbstractButtonDriver extends JComponentDriver implements TextDisplayDriver<AbstractButton>
Supports functional testing of Swing AbstractButton
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 |
---|
AbstractButtonDriver(Robot robot)
Creates a new
AbstractButtonDriver . |
Modifier and Type | Method and Description |
---|---|
void |
deselect(AbstractButton button)
Deselects the given Swing
AbstractButton only if it is selected. |
void |
requireArmed(AbstractButton button)
Verifies that the Swing
AbstractButton is armed. |
void |
requireNotArmed(AbstractButton button)
Verifies that the
AbstractButton is not armed. |
void |
requireNotSelected(AbstractButton button)
Verifies that the
AbstractButton is not selected. |
void |
requireSelected(AbstractButton button)
Verifies that the Swing
AbstractButton is selected. |
void |
requireText(AbstractButton button,
Pattern pattern)
Asserts that the text in the given Swing
AbstractButton matches the given regular expression pattern. |
void |
requireText(AbstractButton button,
String expected)
Asserts that the text in the given Swing
AbstractButton is equal to or matches the specified String
. |
void |
select(AbstractButton button)
Selects the given Swing
AbstractButton only it is not already selected. |
String |
textOf(AbstractButton button)
Returns the text of the given Swing
AbstractButton . |
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 AbstractButtonDriver(@Nonnull Robot robot)
AbstractButtonDriver
.robot
- the robot to use to simulate user input.@RunsInEDT public void requireText(@Nonnull AbstractButton button, @Nullable String expected)
AbstractButton
is equal to or matches the specified String
.requireText
in interface TextDisplayDriver<AbstractButton>
button
- the given AbstractButton
.expected
- the text to match. It can be a regular expression.AssertionError
- if the text of the AbstractButton
is not equal to or does not match the given one.public void requireText(@Nonnull AbstractButton button, @Nonnull Pattern pattern)
AbstractButton
matches the given regular expression pattern.requireText
in interface TextDisplayDriver<AbstractButton>
button
- the given AbstractButton
.pattern
- the regular expression pattern to match.NullPointerException
- if the given regular expression pattern is null
.AssertionError
- if the text of the AbstractButton
does not match the given regular expression
pattern.@RunsInEDT @Nonnull public String textOf(@Nonnull AbstractButton button)
AbstractButton
.textOf
in interface TextDisplayDriver<AbstractButton>
button
- the given AbstractButton
.AbstractButton
.@RunsInEDT public void select(@Nonnull AbstractButton button)
AbstractButton
only it is not already selected.button
- the target AbstractButton
.IllegalStateException
- if the AbstractButton
is disabled.IllegalStateException
- if the AbstractButton
is not showing on the screen.@RunsInEDT public void deselect(@Nonnull AbstractButton button)
AbstractButton
only if it is selected.button
- the target AbstractButton
.IllegalStateException
- if the AbstractButton
is disabled.IllegalStateException
- if the AbstractButton
is not showing on the screen.@RunsInEDT public void requireSelected(@Nonnull AbstractButton button)
AbstractButton
is selected.button
- the given AbstractButton
.AssertionError
- if the button is not selected.@RunsInEDT public void requireNotSelected(@Nonnull AbstractButton button)
AbstractButton
is not selected.button
- the given AbstractButton
.AssertionError
- if the AbstractButton
is selected.@RunsInEDT public void requireArmed(@Nonnull AbstractButton button)
AbstractButton
is armed.button
- the given AbstractButton
.AssertionError
- if the button is not armed.@RunsInEDT public void requireNotArmed(@Nonnull AbstractButton button)
AbstractButton
is not armed.button
- the given AbstractButton
.AssertionError
- if the AbstractButton
is armed.Copyright © 2014–2019 AssertJ. All rights reserved.