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