Package org.fest.swing.driver
Class AbstractButtonDriver
java.lang.Object
org.fest.swing.driver.ComponentDriver
org.fest.swing.driver.ContainerDriver
org.fest.swing.driver.JComponentDriver
org.fest.swing.driver.AbstractButtonDriver
- All Implemented Interfaces:
TextDisplayDriver<AbstractButton>
public class AbstractButtonDriver
extends JComponentDriver
implements TextDisplayDriver<AbstractButton>
Understands functional testing of
AbstractButtons:
- user input simulation
- state verification
- property value query
org.fest.swing.fixture in your tests.-
Field Summary
FieldsFields inherited from class org.fest.swing.driver.ComponentDriver
robot -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidassertThatButtonIsSelected(AbstractButton button, boolean selected) voidrequireNotSelected(AbstractButton button) Verifies that the button is not selected.voidrequireSelected(AbstractButton button) Verifies that the button is selected.voidrequireText(AbstractButton button, String expected) Asserts that the text in the given button is equal to or matches the specifiedString.voidrequireText(AbstractButton button, Pattern pattern) Asserts that the text in the given button matches the given regular expression pattern.voidselect(AbstractButton button) Selects the given button only it is not already selected.private static org.fest.assertions.DescriptionselectedProperty(AbstractButton button) textOf(AbstractButton button) Returns the text of the given button.voidunselect(AbstractButton button) Unselects the given button only if it is selected.private static booleanMethods inherited from class org.fest.swing.driver.JComponentDriver
clientProperty, invokeAction, isVisible, isVisible, requireToolTip, requireToolTip, scrollToVisibleMethods inherited from class org.fest.swing.driver.ContainerDriver
move, resize, resizeHeight, resizeWidthMethods inherited from class org.fest.swing.driver.ComponentDriver
assertIsEnabledAndShowing, click, click, click, click, click, doubleClick, drag, dragOver, drop, focus, focusAndWaitForFocusGain, invokePopupMenu, invokePopupMenu, moveMouseIgnoringAnyError, moveMouseIgnoringAnyError, performAccessibleActionOf, pressAndReleaseKey, pressAndReleaseKey, pressAndReleaseKeys, pressKey, propertyName, releaseKey, requireDisabled, requireEnabled, requireEnabled, requireFocused, requireNotVisible, requireSize, requireVisible, rightClick, settings, waitForShowing
-
Field Details
-
SELECTED_PROPERTY
- See Also:
-
TEXT_PROPERTY
- See Also:
-
-
Constructor Details
-
AbstractButtonDriver
Creates a newAbstractButtonDriver.- Parameters:
robot- the robot to use to simulate user input.
-
-
Method Details
-
requireText
Asserts that the text in the given button is equal to or matches the specifiedString.- Specified by:
requireTextin interfaceTextDisplayDriver<AbstractButton>- Parameters:
button- the given button.expected- the text to match. It can be a regular expression.- Throws:
AssertionError- if the text of the button is not equal to or does not match the given one.
-
requireText
Asserts that the text in the given button matches the given regular expression pattern.- Specified by:
requireTextin interfaceTextDisplayDriver<AbstractButton>- Parameters:
button- the given button.pattern- the regular expression pattern to match.- Throws:
NullPointerException- if the given regular expression pattern isnull.AssertionError- if the text of the button does not match the given regular expression pattern.- Since:
- 1.2
-
textOf
Returns the text of the given button.- Specified by:
textOfin interfaceTextDisplayDriver<AbstractButton>- Parameters:
button- the given button.- Returns:
- the text of the given button.
-
select
Selects the given button only it is not already selected.- Parameters:
button- the target button.- Throws:
IllegalStateException- if the button is disabled.IllegalStateException- if the button is not showing on the screen.
-
unselect
Unselects the given button only if it is selected.- Parameters:
button- the target button.- Throws:
IllegalStateException- if the button is disabled.IllegalStateException- if the button is not showing on the screen.
-
validateAndFindIsSelected
-
requireSelected
Verifies that the button is selected.- Parameters:
button- the given button.- Throws:
AssertionError- if the button is not selected.
-
requireNotSelected
Verifies that the button is not selected.- Parameters:
button- the given button.- Throws:
AssertionError- if the button is selected.
-
assertThatButtonIsSelected
-
selectedProperty
-