public class JSpinnerFixture extends ComponentFixture<JSpinner> implements CommonComponentFixture, JComponentFixture, JPopupMenuInvokerFixture
JSpinner
s:
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target
Constructor and Description |
---|
JSpinnerFixture(Robot robot,
JSpinner target)
Creates a new
. |
JSpinnerFixture(Robot robot,
String spinnerName)
Creates a new
. |
Modifier and Type | Method and Description |
---|---|
JSpinnerFixture |
click()
Simulates a user clicking this fixture's
. |
JSpinnerFixture |
click(MouseButton button)
Simulates a user clicking this fixture's
. |
JSpinnerFixture |
click(MouseClickInfo mouseClickInfo)
Simulates a user clicking this fixture's
. |
Object |
clientProperty(Object key)
Returns the client property stored in this fixture's
, under the given key. |
JSpinnerFixture |
decrement()
Simulates a user decrementing the value of this fixture's
one time. |
JSpinnerFixture |
decrement(int times)
Simulates a user decrementing the value of this fixture's
the given number of times. |
JSpinnerFixture |
doubleClick()
Simulates a user double-clicking this fixture's
. |
protected void |
driver(JSpinnerDriver newDriver)
Sets the
to be used by this fixture. |
JSpinnerFixture |
enterText(String text)
Simulates a user entering the given text in this fixture's
(assuming its editor has a
under it.) This method does not commit the value to the JSpinner . |
JSpinnerFixture |
enterTextAndCommit(String text)
Simulates a user entering and committing the given text in this fixture's
(assuming
its editor has a under it.) |
JSpinnerFixture |
focus()
Gives input focus to this fixture's
. |
JSpinnerFixture |
increment()
Simulates a user incrementing the value of this fixture's
one time. |
JSpinnerFixture |
increment(int times)
Simulates a user incrementing the value of this fixture's
the given number of times. |
JSpinnerFixture |
pressAndReleaseKey(KeyPressInfo keyPressInfo)
Simulates a user pressing given key with the given modifiers on this fixture's
. |
JSpinnerFixture |
pressAndReleaseKeys(int... keyCodes)
Simulates a user pressing and releasing the given keys on this fixture's
. |
JSpinnerFixture |
pressKey(int keyCode)
Simulates a user pressing the given key on this fixture's
. |
JSpinnerFixture |
releaseKey(int keyCode)
Simulates a user releasing the given key on this fixture's
. |
JSpinnerFixture |
requireDisabled()
Asserts that this fixture's
is disabled. |
JSpinnerFixture |
requireEnabled()
Asserts that this fixture's
is enabled. |
JSpinnerFixture |
requireEnabled(Timeout timeout)
Asserts that this fixture's
is enabled. |
JSpinnerFixture |
requireFocused()
Asserts that this fixture's
has input focus. |
JSpinnerFixture |
requireNotVisible()
Asserts that this fixture's
is not visible. |
JSpinnerFixture |
requireToolTip(Pattern pattern)
Asserts that the toolTip in this fixture's
matches the given regular expression
pattern. |
JSpinnerFixture |
requireToolTip(String expected)
Asserts that the toolTip in this fixture's
matches the given value. |
JSpinnerFixture |
requireValue(Object value)
Verifies that the value of this fixture's
is equal to the given one. |
JSpinnerFixture |
requireVisible()
Asserts that this fixture's
is visible. |
JSpinnerFixture |
rightClick()
Simulates a user right-clicking this fixture's
. |
Object |
select(Object value)
Selects the given value in this fixture's
. |
JPopupMenuFixture |
showPopupMenu()
Shows a pop-up menu using this fixture's
as the invoker of the pop-up menu. |
JPopupMenuFixture |
showPopupMenuAt(Point p)
Shows a pop-up menu at the given point using this fixture's
as the invoker of the
pop-up menu. |
String |
text()
Returns the text displayed by this fixture's
. |
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNull
public JSpinnerFixture(Robot robot, String spinnerName)
JSpinnerFixture
.robot
- performs simulation of user events on a JSpinner
.spinnerName
- the name of the JSpinner
to find using the given Robot
.NullPointerException
- if robot
is null
.ComponentLookupException
- if a matching JSpinner
could not be found.ComponentLookupException
- if more than one matching JSpinner
is found.public JSpinnerFixture(Robot robot, JSpinner target)
JSpinnerFixture
.robot
- performs simulation of user events on the given JSpinner
.target
- the JSpinner
to be managed by this fixture.NullPointerException
- if robot
is null
.NullPointerException
- if target
is null
.protected final void driver(JSpinnerDriver newDriver)
JSpinnerDriver
to be used by this fixture.newDriver
- the new JSpinnerDriver
.NullPointerException
- if the given driver is null
.public JSpinnerFixture increment(int times)
JSpinner
the given number of times.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 this fixture's JSpinner
is disabled.IllegalStateException
- if this fixture's JSpinner
is not showing on the screen.public JSpinnerFixture increment()
JSpinner
one time.IllegalStateException
- if this fixture's JSpinner
is disabled.IllegalStateException
- if this fixture's JSpinner
is not showing on the screen.public JSpinnerFixture decrement(int times)
JSpinner
the given number of times.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 this fixture's JSpinner
is disabled.IllegalStateException
- if this fixture's JSpinner
is not showing on the screen.public JSpinnerFixture decrement()
JSpinner
one time.IllegalStateException
- if this fixture's JSpinner
is disabled.IllegalStateException
- if this fixture's JSpinner
is not showing on the screen.public JSpinnerFixture enterText(String text)
JSpinner
(assuming its editor has a
JTextComponent
under it.) This method does not commit the value to the JSpinner
.text
- the text to enter.IllegalStateException
- if this fixture's JSpinner
is disabled.IllegalStateException
- if this fixture's JSpinner
is not showing on the screen.ActionFailedException
- if the editor of the JSpinner
is not a JTextComponent
or
cannot be found.UnexpectedException
- if the entering the text in the JSpinner
's editor fails.public JSpinnerFixture enterTextAndCommit(String text)
JSpinner
(assuming
its editor has a JTextComponent
under it.)text
- the text to enter.IllegalStateException
- if this fixture's JSpinner
is disabled.IllegalStateException
- if this fixture's JSpinner
is not showing on the screen.ActionFailedException
- if the editor of the JSpinner
is not a JTextComponent
or
cannot be found.UnexpectedException
- if the entering the text in the JSpinner
's editor fails.public Object select(Object value)
JSpinner
.value
- the value to select.IllegalStateException
- if this fixture's JSpinner
is disabled.IllegalStateException
- if this fixture's JSpinner
is not showing on the screen.IllegalArgumentException
- if the JSpinner
does not support the specified value
.public JSpinnerFixture click()
JSpinner
.click
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JSpinner
is disabled.IllegalStateException
- if this fixture's JSpinner
is not showing on the screen.public JSpinnerFixture click(MouseButton button)
JSpinner
.click
in interface MouseInputSimulationFixture
button
- the button to click.NullPointerException
- if the given MouseButton
is null
.IllegalStateException
- if this fixture's JSpinner
is disabled.IllegalStateException
- if this fixture's JSpinner
is not showing on the screen.public JSpinnerFixture click(MouseClickInfo mouseClickInfo)
JSpinner
.click
in interface MouseInputSimulationFixture
mouseClickInfo
- specifies the button to click and the times the button should be clicked.NullPointerException
- if the given MouseClickInfo
is null
.IllegalStateException
- if this fixture's JSpinner
is disabled.IllegalStateException
- if this fixture's JSpinner
is not showing on the screen.public JSpinnerFixture rightClick()
JSpinner
.rightClick
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JSpinner
is disabled.IllegalStateException
- if this fixture's JSpinner
is not showing on the screen.public JSpinnerFixture doubleClick()
JSpinner
.doubleClick
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JSpinner
is disabled.IllegalStateException
- if this fixture's JSpinner
is not showing on the screen.public JSpinnerFixture focus()
JSpinner
.focus
in interface FocusableComponentFixture
IllegalStateException
- if this fixture's JSpinner
is disabled.IllegalStateException
- if this fixture's JSpinner
is not showing on the screen.public JSpinnerFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
JSpinner
.
Modifiers is a mask from the available InputEvent
masks.pressAndReleaseKey
in interface KeyboardInputSimulationFixture
keyPressInfo
- specifies the key and modifiers to press.NullPointerException
- if the given KeyPressInfo
is null
.IllegalArgumentException
- if the given code is not a valid key code.IllegalStateException
- if this fixture's JSpinner
is disabled.IllegalStateException
- if this fixture's JSpinner
is not showing on the screen.KeyPressInfo
public JSpinnerFixture pressAndReleaseKeys(int... keyCodes)
JSpinner
. This method
does not affect the current focus.pressAndReleaseKeys
in interface KeyboardInputSimulationFixture
keyCodes
- one or more codes of the keys to press.NullPointerException
- if the given array of codes is null
.IllegalArgumentException
- if any of the given code is not a valid key code.IllegalStateException
- if this fixture's JSpinner
is disabled.IllegalStateException
- if this fixture's JSpinner
is not showing on the screen.KeyEvent
public JSpinnerFixture pressKey(int keyCode)
JSpinner
.pressKey
in interface KeyboardInputSimulationFixture
keyCode
- the code of the key to press.IllegalArgumentException
- if any of the given code is not a valid key code.IllegalStateException
- if this fixture's JSpinner
is disabled.IllegalStateException
- if this fixture's JSpinner
is not showing on the screen.KeyEvent
public JSpinnerFixture releaseKey(int keyCode)
JSpinner
.releaseKey
in interface KeyboardInputSimulationFixture
keyCode
- the code of the key to release.IllegalArgumentException
- if any of the given code is not a valid key code.IllegalStateException
- if this fixture's JSpinner
is disabled.IllegalStateException
- if this fixture's JSpinner
is not showing on the screen.KeyEvent
public JSpinnerFixture requireFocused()
JSpinner
has input focus.requireFocused
in interface FocusableComponentFixture
AssertionError
- if this fixture's JSpinner
does not have input focus.public JSpinnerFixture requireEnabled()
JSpinner
is enabled.requireEnabled
in interface StateVerificationFixture
AssertionError
- if this fixture's JSpinner
is disabled.public JSpinnerFixture requireEnabled(Timeout timeout)
JSpinner
is enabled.requireEnabled
in interface StateVerificationFixture
timeout
- the time this fixture will wait for the component to be enabled.WaitTimedOutError
- if this fixture's JSpinner
is never enabled.public JSpinnerFixture requireDisabled()
JSpinner
is disabled.requireDisabled
in interface StateVerificationFixture
AssertionError
- if this fixture's JSpinner
is enabled.public JSpinnerFixture requireVisible()
JSpinner
is visible.requireVisible
in interface StateVerificationFixture
AssertionError
- if this fixture's JSpinner
is not visible.public JSpinnerFixture requireNotVisible()
JSpinner
is not visible.requireNotVisible
in interface StateVerificationFixture
AssertionError
- if this fixture's JSpinner
is visible.public JSpinnerFixture requireValue(Object value)
JSpinner
is equal to the given one.value
- the expected value of this fixture's JSpinner
.AssertionError
- if the value of this fixture's JSpinner
is not equal to the given one.public String text()
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.JSpinner
.public JSpinnerFixture requireToolTip(String expected)
JSpinner
matches the given value.requireToolTip
in interface ToolTipDisplayFixture
expected
- the given value. It can be a regular expression.AssertionError
- if the toolTip in this fixture's JSpinner
does not match the given value.public JSpinnerFixture requireToolTip(Pattern pattern)
JSpinner
matches the given regular expression
pattern.requireToolTip
in interface ToolTipDisplayFixture
pattern
- the regular expression pattern to match.NullPointerException
- if the given regular expression pattern is null
.AssertionError
- if the toolTip in this fixture's JSpinner
does not match the given regular
expression.public Object clientProperty(Object key)
JSpinner
, under the given key.clientProperty
in interface ClientPropertyStorageFixture
key
- the key to use to retrieve the client property.null
if the property was
not found.NullPointerException
- if the given key is null
.public JPopupMenuFixture showPopupMenu()
JSpinner
as the invoker of the pop-up menu.showPopupMenu
in interface JPopupMenuInvokerFixture
IllegalStateException
- if this fixture's JSpinner
is disabled.IllegalStateException
- if this fixture's JSpinner
is not showing on the screen.ComponentLookupException
- if a pop-up menu cannot be found.public JPopupMenuFixture showPopupMenuAt(Point p)
JSpinner
as the invoker of the
pop-up menu.showPopupMenuAt
in interface JPopupMenuInvokerFixture
p
- the given point where to show the pop-up menu.IllegalStateException
- if this fixture's JSpinner
is disabled.IllegalStateException
- if this fixture's JSpinner
is not showing on the screen.ComponentLookupException
- if a pop-up menu cannot be found.Copyright © 2007-2013 FEST (Fixtures for Easy Software Testing). All Rights Reserved.