Package org.fest.swing.driver
Class JSpinnerDriver
java.lang.Object
org.fest.swing.driver.ComponentDriver
org.fest.swing.driver.ContainerDriver
org.fest.swing.driver.JComponentDriver
org.fest.swing.driver.JSpinnerDriver
Understands functional testing of
JSpinners:
- 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 static voidvoidDecrements the value of the.JSpinnervoidDecrements the value of thethe given number of times.JSpinnerprivate static voiddecrementValue(JSpinner spinner, int times) Returns theused as editor in the givenJTextComponent.JSpinnervoidEnters the given text in the, assuming its editor has aJSpinnerunder it.JTextComponentvoidenterTextAndCommit(JSpinner spinner, String text) Enters and commits the given text in the, assuming its editor has aJSpinnerunder it.JTextComponentprivate JTextComponentfindEditor(JSpinner spinner) voidIncrements the value of the.JSpinnervoidIncrements the value of thethe given number of times.JSpinnerprivate static voidincrementValue(JSpinner spinner, int times) voidrequireValue(JSpinner spinner, Object value) Verifies that the value of theis equal to the given one.JSpinnervoidselectValue(JSpinner spinner, Object value) Selects the given value in the given.JSpinnerReturns the text displayed in the given.JSpinnerprivate voidprivate static voidvalidate(JSpinner spinner, JTextComponent editor) private static voidvalidateAndDecrementValue(JSpinner spinner) private static voidvalidateAndDecrementValue(JSpinner spinner, int times) private static voidvalidateAndIncrementValue(JSpinner spinner) private static voidvalidateAndIncrementValue(JSpinner spinner, int times) Methods 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
-
EDITOR_MATCHER
-
VALUE_PROPERTY
- See Also:
-
-
Constructor Details
-
JSpinnerDriver
Creates a newJSpinnerDriver.- Parameters:
robot- the robot to use to simulate user input.
-
-
Method Details
-
increment
Increments the value of thethe given number of times.JSpinner- Parameters:
spinner- the targetJSpinner.times- how many times the value of this fixture'sJSpinnershould be incremented.- Throws:
IllegalArgumentException- iftimesis less than or equal to zero.IllegalStateException- if theJSpinneris disabled.IllegalStateException- if theJSpinneris not showing on the screen.
-
validateAndIncrementValue
-
incrementValue
-
increment
Increments the value of the.JSpinner- Parameters:
spinner- the targetJSpinner.- Throws:
IllegalStateException- if theJSpinneris disabled.IllegalStateException- if theJSpinneris not showing on the screen.
-
validateAndIncrementValue
-
decrement
Decrements the value of thethe given number of times.JSpinner- Parameters:
spinner- the targetJSpinner.times- how many times the value of this fixture'sJSpinnershould be decremented.- Throws:
IllegalArgumentException- iftimesis less than or equal to zero.IllegalStateException- if theJSpinneris disabled.IllegalStateException- if theJSpinneris not showing on the screen.
-
validate
-
validateAndDecrementValue
-
decrementValue
-
decrement
Decrements the value of the.JSpinner- Parameters:
spinner- the targetJSpinner.- Throws:
IllegalStateException- if theJSpinneris disabled.IllegalStateException- if theJSpinneris not showing on the screen.
-
validateAndDecrementValue
-
textOf
Returns the text displayed in the given. This method first tries to get the text displayed in theJSpinnerJSpinner's editor, assuming it is a. If the text from the editor cannot be retrieved, it will return theJTextComponentStringrepresentation of the value in theJSpinner's model.- Parameters:
spinner- the targetJSpinner.- Returns:
- the text displayed in the given
JSpinner. - Since:
- 1.2
-
enterTextAndCommit
Enters and commits the given text in the, assuming its editor has aJSpinnerunder it.JTextComponent- Parameters:
spinner- the targetJSpinner.text- the text to enter.- Throws:
IllegalStateException- if theJSpinneris disabled.IllegalStateException- if theJSpinneris not showing on the screen.ActionFailedException- if the editor of theJSpinneris not aJTextComponentor cannot be found.UnexpectedException- if entering the text in theJSpinner's editor fails.
-
commit
-
enterText
Enters the given text in the, assuming its editor has aJSpinnerunder it. This method does not commit the value to theJTextComponentJSpinner.- Parameters:
spinner- the targetJSpinner.text- the text to enter.- Throws:
IllegalStateException- if theJSpinneris disabled.IllegalStateException- if theJSpinneris not showing on the screen.ActionFailedException- if the editor of theJSpinneris not aJTextComponentor cannot be found.UnexpectedException- if entering the text in theJSpinner's editor fails.- See Also:
-
findEditor
-
validate
-
selectValue
Selects the given value in the given.JSpinner- Parameters:
spinner- the targetJSpinner.value- the value to select.- Throws:
IllegalStateException- if theJSpinneris disabled.IllegalStateException- if theJSpinneris not showing on the screen.IllegalArgumentException- if the givenJSpinnerdoes not support the given value.
-
editor
Returns theused as editor in the givenJTextComponent.JSpinner- Parameters:
spinner- the targetJSpinner.- Returns:
- the
JTextComponentused as editor in the givenJSpinner. - Throws:
ComponentLookupException- if the givenJSpinnerdoes not have aJTextComponentas editor.
-
requireValue
Verifies that the value of theis equal to the given one.JSpinner- Parameters:
spinner- the targetJSpinner.value- the expected value.- Throws:
AssertionError- if the value of theJSpinneris not equal to the given one.
-