public class JMenuItemFixture extends ComponentFixture<JMenuItem> implements KeyboardInputSimulationFixture, StateVerificationFixture
JMenuItem
s:
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target
Constructor and Description |
---|
JMenuItemFixture(Robot robot,
JMenuItem target)
Creates a new
. |
JMenuItemFixture(Robot robot,
String menuItemName)
Creates a new
. |
Modifier and Type | Method and Description |
---|---|
JMenuItemFixture |
click()
Simulates a user selecting this fixture's
. |
protected void |
driver(JMenuItemDriver newDriver)
Sets the
to be used by this fixture. |
JMenuItemFixture |
focus()
Gives input focus to this fixture's
. |
JMenuItemFixture |
pressAndReleaseKey(KeyPressInfo keyPressInfo)
Simulates a user pressing given key with the given modifiers on this fixture's
. |
JMenuItemFixture |
pressAndReleaseKeys(int... keyCodes)
Simulates a user pressing and releasing the given keys on this fixture's
. |
JMenuItemFixture |
pressKey(int keyCode)
Simulates a user pressing the given key on this fixture's
. |
JMenuItemFixture |
releaseKey(int keyCode)
Simulates a user releasing the given key on this fixture's
. |
JMenuItemFixture |
requireDisabled()
Asserts that this fixture's
is disabled. |
JMenuItemFixture |
requireEnabled()
Asserts that this fixture's
is enabled. |
JMenuItemFixture |
requireEnabled(Timeout timeout)
Asserts that this fixture's
is enabled. |
JMenuItemFixture |
requireNotVisible()
Asserts that this fixture's
is not visible. |
JMenuItemFixture |
requireVisible()
Asserts that this fixture's
is visible. |
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNull
public JMenuItemFixture(Robot robot, String menuItemName)
JMenuItemFixture
.robot
- performs simulation of user events on a JMenuItem
.menuItemName
- the name of the JMenuItem
to find using the given Robot
.NullPointerException
- if robot
is null
.ComponentLookupException
- if a matching JMenuItem
could not be found.ComponentLookupException
- if more than one matching JMenuItem
is found.public JMenuItemFixture(Robot robot, JMenuItem target)
JMenuItemFixture
.robot
- performs simulation of user events on the given JMenuItem
.target
- the JMenuItem
to be managed by this fixture.NullPointerException
- if robot
is null
.NullPointerException
- if target
is null
.protected final void driver(JMenuItemDriver newDriver)
JMenuItemDriver
to be used by this fixture.newDriver
- the new JMenuItemDriver
.NullPointerException
- if the given driver is null
.public JMenuItemFixture click()
JMenuItem
.IllegalStateException
- if this fixture's JMenuItem
is disabled.IllegalStateException
- if this fixture's JMenuItem
is not showing on the screen.ActionFailedException
- if the menu has a pop-up and it fails to show up.public JMenuItemFixture focus()
JMenuItem
.IllegalStateException
- if this fixture's JMenuItem
is disabled.IllegalStateException
- if this fixture's JMenuItem
is not showing on the screen.public JMenuItemFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
JMenuItem
.
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 JMenuItem
is disabled.IllegalStateException
- if this fixture's JMenuItem
is not showing on the screen.KeyPressInfo
public JMenuItemFixture pressAndReleaseKeys(int... keyCodes)
JMenuItem
.pressAndReleaseKeys
in interface KeyboardInputSimulationFixture
keyCodes
- one or more codes of the keys to press.IllegalStateException
- if this fixture's JMenuItem
is disabled.IllegalStateException
- if this fixture's JMenuItem
is not showing on the screen.KeyEvent
public JMenuItemFixture pressKey(int keyCode)
JMenuItem
.pressKey
in interface KeyboardInputSimulationFixture
keyCode
- the code of the key to press.IllegalStateException
- if this fixture's JMenuItem
is disabled.IllegalStateException
- if this fixture's JMenuItem
is not showing on the screen.KeyEvent
public JMenuItemFixture releaseKey(int keyCode)
JMenuItem
.releaseKey
in interface KeyboardInputSimulationFixture
keyCode
- the code of the key to release.IllegalStateException
- if this fixture's JMenuItem
is disabled.IllegalStateException
- if this fixture's JMenuItem
is not showing on the screen.KeyEvent
public JMenuItemFixture requireEnabled()
JMenuItem
is enabled.requireEnabled
in interface StateVerificationFixture
AssertionError
- if this fixture's JMenuItem
is disabled.public JMenuItemFixture requireEnabled(Timeout timeout)
JMenuItem
is enabled.requireEnabled
in interface StateVerificationFixture
timeout
- the time this fixture will wait for the component to be enabled.WaitTimedOutError
- if this fixture's JMenuItem
is never enabled.public JMenuItemFixture requireDisabled()
JMenuItem
is disabled.requireDisabled
in interface StateVerificationFixture
AssertionError
- if this fixture's JMenuItem
is enabled.public JMenuItemFixture requireVisible()
JMenuItem
is visible.requireVisible
in interface StateVerificationFixture
AssertionError
- if this fixture's JMenuItem
is not visible.public JMenuItemFixture requireNotVisible()
JMenuItem
is not visible.requireNotVisible
in interface StateVerificationFixture
AssertionError
- if this fixture's JMenuItem
is visible.Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.