public class JSpinnerDriver extends JComponentDriver
Supports functional testing of JSpinner
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 |
---|
JSpinnerDriver(Robot robot)
Creates a new
JSpinnerDriver . |
Modifier and Type | Method and Description |
---|---|
void |
decrement(JSpinner spinner)
Decrements the value of the
JSpinner . |
void |
decrement(JSpinner spinner,
int times)
Decrements the value of the
JSpinner the given number of times. |
JTextComponent |
editor(JSpinner spinner)
Returns the
JTextComponent used as editor in the given JSpinner . |
void |
enterText(JSpinner spinner,
String text)
Enters the given text in the
JSpinner , assuming its editor has a JTextComponent under it. |
void |
enterTextAndCommit(JSpinner spinner,
String text)
Enters and commits the given text in the
JSpinner , assuming its editor has a JTextComponent under
it. |
void |
increment(JSpinner spinner)
Increments the value of the
JSpinner . |
void |
increment(JSpinner spinner,
int times)
Increments the value of the
JSpinner the given number of times. |
void |
requireValue(JSpinner spinner,
Object value)
Verifies that the value of the
JSpinner is equal to the given one. |
void |
selectValue(JSpinner spinner,
Object value)
Selects the given value in the given
JSpinner . |
String |
textOf(JSpinner spinner)
Returns the text displayed in the given
JSpinner . |
clientProperty, invokeAction, isVisible, isVisible, requireToolTip, requireToolTip, scrollToVisible
doResizeHeight, doResizeWidth, isResizable, move, resize
backgroundOf, checkInEdtEnabledAndShowing, click, click, click, click, click, doubleClick, drag, dragOver, drop, focus, focusAndWaitForFocusGain, fontOf, foregroundOf, invokePopupMenu, invokePopupMenu, moveMouseIgnoringAnyError, moveMouseIgnoringAnyError, performAccessibleActionOf, pressAndReleaseKey, pressAndReleaseKey, pressAndReleaseKeys, pressKey, propertyName, releaseKey, requireDisabled, requireEnabled, requireEnabled, requireFocused, requireNotVisible, requireSize, requireVisible, rightClick, settings, waitForShowing
public JSpinnerDriver(@Nonnull Robot robot)
JSpinnerDriver
.robot
- the robot to use to simulate user input.@RunsInEDT public void increment(@Nonnull JSpinner spinner, int times)
JSpinner
the given number of times.spinner
- the target JSpinner
.times
- how many times the value of this fixture's JSpinner
should be incremented.IllegalArgumentException
- if times
is less than or equal to zero.IllegalStateException
- if the JSpinner
is disabled.IllegalStateException
- if the JSpinner
is not showing on the screen.@RunsInEDT public void increment(@Nonnull JSpinner spinner)
JSpinner
.spinner
- the target JSpinner
.IllegalStateException
- if the JSpinner
is disabled.IllegalStateException
- if the JSpinner
is not showing on the screen.@RunsInEDT public void decrement(@Nonnull JSpinner spinner, int times)
JSpinner
the given number of times.spinner
- the target JSpinner
.times
- how many times the value of this fixture's JSpinner
should be decremented.IllegalArgumentException
- if times
is less than or equal to zero.IllegalStateException
- if the JSpinner
is disabled.IllegalStateException
- if the JSpinner
is not showing on the screen.@RunsInEDT public void decrement(@Nonnull JSpinner spinner)
JSpinner
.spinner
- the target JSpinner
.IllegalStateException
- if the JSpinner
is disabled.IllegalStateException
- if the JSpinner
is not showing on the screen.@RunsInEDT @Nullable public String textOf(@Nonnull JSpinner spinner)
JSpinner
. This method first tries to get the text displayed in the
JSpinner
's editor, assuming it is a JTextComponent
. If the text from the editor cannot be
retrieved, it will return the String
representation of the value in the JSpinner
's model.spinner
- the target JSpinner
.JSpinner
.@RunsInEDT public void enterTextAndCommit(@Nonnull JSpinner spinner, String text)
JSpinner
, assuming its editor has a JTextComponent
under
it.spinner
- the target JSpinner
.text
- the text to enter.IllegalStateException
- if the JSpinner
is disabled.IllegalStateException
- if the JSpinner
is not showing on the screen.ActionFailedException
- if the editor of the JSpinner
is not a JTextComponent
or cannot be
found.UnexpectedException
- if entering the text in the JSpinner
's editor fails.@RunsInEDT public void enterText(@Nonnull JSpinner spinner, @Nonnull String text)
JSpinner
, assuming its editor has a JTextComponent
under it. This
method does not commit the value to the JSpinner
.spinner
- the target JSpinner
.text
- the text to enter.IllegalStateException
- if the JSpinner
is disabled.IllegalStateException
- if the JSpinner
is not showing on the screen.ActionFailedException
- if the editor of the JSpinner
is not a JTextComponent
or cannot be
found.UnexpectedException
- if entering the text in the JSpinner
's editor fails.enterTextAndCommit(JSpinner, String)
@RunsInEDT public void selectValue(@Nonnull JSpinner spinner, @Nonnull Object value)
JSpinner
.spinner
- the target JSpinner
.value
- the value to select.IllegalStateException
- if the JSpinner
is disabled.IllegalStateException
- if the JSpinner
is not showing on the screen.IllegalArgumentException
- if the given JSpinner
does not support the given value.@RunsInEDT public JTextComponent editor(@Nonnull JSpinner spinner)
JTextComponent
used as editor in the given JSpinner
.spinner
- the target JSpinner
.JTextComponent
used as editor in the given JSpinner
.ComponentLookupException
- if the given JSpinner
does not have a JTextComponent
as editor.@RunsInEDT public void requireValue(@Nonnull JSpinner spinner, Object value)
JSpinner
is equal to the given one.spinner
- the target JSpinner
.value
- the expected value.AssertionError
- if the value of the JSpinner
is not equal to the given one.Copyright © 2014-2015 AssertJ. All Rights Reserved.