public class JToggleButtonFixture extends ComponentFixture<JToggleButton> implements CommonComponentFixture, JComponentFixture, JPopupMenuInvokerFixture, TextDisplayFixture, TwoStateButtonFixture
JToggleButton
s:
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target
Constructor and Description |
---|
JToggleButtonFixture(Robot robot,
JToggleButton target)
Creates a new
. |
JToggleButtonFixture(Robot robot,
String toggleButtonName)
Creates a new
. |
Modifier and Type | Method and Description |
---|---|
JToggleButtonFixture |
check()
Checks (or selects) this fixture's
only it is not already checked. |
JToggleButtonFixture |
click()
Simulates a user clicking this fixture's
. |
JToggleButtonFixture |
click(MouseButton button)
Simulates a user clicking this fixture's
. |
JToggleButtonFixture |
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. |
JToggleButtonFixture |
doubleClick()
Simulates a user double-clicking this fixture's
. |
protected void |
driver(AbstractButtonDriver newDriver)
Sets the
to be used by this fixture. |
JToggleButtonFixture |
focus()
Gives input focus to this fixture's
. |
JToggleButtonFixture |
pressAndReleaseKey(KeyPressInfo keyPressInfo)
Simulates a user pressing given key with the given modifiers on this fixture's
. |
JToggleButtonFixture |
pressAndReleaseKeys(int... keyCodes)
Simulates a user pressing and releasing the given keys on this fixture's
. |
JToggleButtonFixture |
pressKey(int keyCode)
Simulates a user pressing the given key on this fixture's
. |
JToggleButtonFixture |
releaseKey(int keyCode)
Simulates a user releasing the given key on this fixture's
. |
JToggleButtonFixture |
requireDisabled()
Asserts that this fixture's
is disabled. |
JToggleButtonFixture |
requireEnabled()
Asserts that this fixture's
is enabled. |
JToggleButtonFixture |
requireEnabled(Timeout timeout)
Asserts that this fixture's
is enabled. |
JToggleButtonFixture |
requireFocused()
Asserts that this fixture's
has input focus. |
JToggleButtonFixture |
requireNotSelected()
Verifies that this fixture's
is not selected. |
JToggleButtonFixture |
requireNotVisible()
Asserts that this fixture's
is not visible. |
JToggleButtonFixture |
requireSelected()
Verifies that this fixture's
is selected. |
JToggleButtonFixture |
requireText(Pattern pattern)
Asserts that the text of this fixture's
matches the given regular expression
pattern. |
JToggleButtonFixture |
requireText(String expected)
Asserts that the text of this fixture's
matches the specified value. |
JToggleButtonFixture |
requireToolTip(Pattern pattern)
Asserts that the toolTip in this fixture's
matches the given regular expression
pattern. |
JToggleButtonFixture |
requireToolTip(String expected)
Asserts that the toolTip in this fixture's
matches the given value. |
JToggleButtonFixture |
requireVisible()
Asserts that this fixture's
is visible. |
JToggleButtonFixture |
rightClick()
Simulates a user right-clicking 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 of this fixture's
. |
JToggleButtonFixture |
uncheck()
Unchecks this fixture's
only if it is checked. |
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNull
public JToggleButtonFixture(Robot robot, JToggleButton target)
JToggleButtonFixture
.robot
- performs simulation of user events on the given JToggleButton
.target
- the JToggleButton
to be managed by this fixture.NullPointerException
- if robot
is null
.NullPointerException
- if target
is null
.public JToggleButtonFixture(Robot robot, String toggleButtonName)
JToggleButtonFixture
.robot
- performs simulation of user events on a JToggleButton
.toggleButtonName
- the name of the JToggleButton
to find using the given Robot
.NullPointerException
- if robot
is null
.ComponentLookupException
- if a matching JToggleButton
could not be found.ComponentLookupException
- if more than one matching JToggleButton
is found.protected final void driver(AbstractButtonDriver newDriver)
AbstractButtonDriver
to be used by this fixture.newDriver
- the new AbstractButtonDriver
.NullPointerException
- if the given driver is null
.public String text()
JToggleButton
.text
in interface TextDisplayFixture
JToggleButton
.public JToggleButtonFixture check()
JToggleButton
only it is not already checked.IllegalStateException
- if this fixture's JToggleButton
is disabled.IllegalStateException
- if this fixture's JToggleButton
is not showing on the screen.public JToggleButtonFixture uncheck()
JToggleButton
only if it is checked.IllegalStateException
- if this fixture's JToggleButton
is disabled.IllegalStateException
- if this fixture's JToggleButton
is not showing on the screen.public JToggleButtonFixture click()
JToggleButton
.click
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JToggleButton
is disabled.IllegalStateException
- if this fixture's JToggleButton
is not showing on the screen.public JToggleButtonFixture click(MouseButton button)
JToggleButton
.click
in interface MouseInputSimulationFixture
button
- the button to click.NullPointerException
- if the given MouseButton
is null
.IllegalStateException
- if this fixture's JToggleButton
is disabled.IllegalStateException
- if this fixture's JToggleButton
is not showing on the screen.public JToggleButtonFixture click(MouseClickInfo mouseClickInfo)
JToggleButton
.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 JToggleButton
is disabled.IllegalStateException
- if this fixture's JToggleButton
is not showing on the screen.public JToggleButtonFixture doubleClick()
JToggleButton
.doubleClick
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JToggleButton
is disabled.IllegalStateException
- if this fixture's JToggleButton
is not showing on the screen.public JToggleButtonFixture rightClick()
JToggleButton
.rightClick
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JToggleButton
is disabled.IllegalStateException
- if this fixture's JToggleButton
is not showing on the screen.public JToggleButtonFixture focus()
JToggleButton
.focus
in interface FocusableComponentFixture
IllegalStateException
- if this fixture's JToggleButton
is disabled.IllegalStateException
- if this fixture's JToggleButton
is not showing on the screen.public JToggleButtonFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
JToggleButton
.
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 JToggleButton
is disabled.IllegalStateException
- if this fixture's JToggleButton
is not showing on the screen.KeyPressInfo
public JToggleButtonFixture pressAndReleaseKeys(int... keyCodes)
JToggleButton
.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 JToggleButton
is disabled.IllegalStateException
- if this fixture's JToggleButton
is not showing on the screen.KeyEvent
public JToggleButtonFixture pressKey(int keyCode)
JToggleButton
.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 JToggleButton
is disabled.IllegalStateException
- if this fixture's JToggleButton
is not showing on the screen.KeyEvent
public JToggleButtonFixture releaseKey(int keyCode)
JToggleButton
.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 JToggleButton
is disabled.IllegalStateException
- if this fixture's JToggleButton
is not showing on the screen.KeyEvent
public JToggleButtonFixture requireSelected()
JToggleButton
is selected.requireSelected
in interface TwoStateButtonFixture
AssertionError
- if this fixture's JToggleButton
is not selected.public JToggleButtonFixture requireNotSelected()
JToggleButton
is not selected.requireNotSelected
in interface TwoStateButtonFixture
AssertionError
- if this fixture's JToggleButton
is selected.public JToggleButtonFixture requireText(String expected)
JToggleButton
matches the specified value.requireText
in interface TextDisplayFixture
expected
- the text to match. It can be a regular expression.AssertionError
- if the text of the target JToggleButton does not match the given one.public JToggleButtonFixture requireText(Pattern pattern)
JToggleButton
matches the given regular expression
pattern.requireText
in interface TextDisplayFixture
pattern
- the regular expression pattern to match.NullPointerException
- if the given regular expression pattern is null
.AssertionError
- if the text of the target JToggleButton
does not match the given regular
expression pattern.public JToggleButtonFixture requireFocused()
JToggleButton
has input focus.requireFocused
in interface FocusableComponentFixture
AssertionError
- if this fixture's JToggleButton
does not have input focus.public JToggleButtonFixture requireEnabled()
JToggleButton
is enabled.requireEnabled
in interface StateVerificationFixture
AssertionError
- if this fixture's JToggleButton
is disabled.public JToggleButtonFixture requireEnabled(Timeout timeout)
JToggleButton
is enabled.requireEnabled
in interface StateVerificationFixture
timeout
- the time this fixture will wait for the component to be enabled.WaitTimedOutError
- if this fixture's JToggleButton
is never enabled.public JToggleButtonFixture requireDisabled()
JToggleButton
is disabled.requireDisabled
in interface StateVerificationFixture
AssertionError
- if this fixture's JToggleButton
is enabled.public JToggleButtonFixture requireVisible()
JToggleButton
is visible.requireVisible
in interface StateVerificationFixture
AssertionError
- if this fixture's JToggleButton
is not visible.public JToggleButtonFixture requireNotVisible()
JToggleButton
is not visible.requireNotVisible
in interface StateVerificationFixture
AssertionError
- if this fixture's JToggleButton
is visible.public JToggleButtonFixture requireToolTip(String expected)
JToggleButton
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 JToggleButton
does not match the given value.public JToggleButtonFixture requireToolTip(Pattern pattern)
JToggleButton
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 JToggleButton
does not match the given
regular expression.public Object clientProperty(Object key)
JToggleButton
, 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()
JToggleButton
as the invoker of the pop-up menu.showPopupMenu
in interface JPopupMenuInvokerFixture
IllegalStateException
- if this fixture's JToggleButton
is disabled.IllegalStateException
- if this fixture's JToggleButton
is not showing on the screen.ComponentLookupException
- if a pop-up menu cannot be found.public JPopupMenuFixture showPopupMenuAt(Point p)
JToggleButton
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 JToggleButton
is disabled.IllegalStateException
- if this fixture's JToggleButton
is not showing on the screen.ComponentLookupException
- if a pop-up menu cannot be found.Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.