Package org.fest.swing.fixture
Class JPopupMenuFixture
- All Implemented Interfaces:
CommonComponentFixture
,FocusableComponentFixture
,KeyboardInputSimulationFixture
,MouseInputSimulationFixture
,StateVerificationFixture
public class JPopupMenuFixture
extends ComponentFixture<JPopupMenu>
implements CommonComponentFixture
Understands functional testing of
JPopupMenu
s:
- user input simulation
- state verification
- property value query
-
Field Summary
FieldsFields inherited from class org.fest.swing.fixture.ComponentFixture
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target
-
Constructor Summary
ConstructorsConstructorDescriptionJPopupMenuFixture
(Robot robot, JPopupMenu target) Creates a new
.JPopupMenuFixture
-
Method Summary
Modifier and TypeMethodDescriptionclick()
Simulates a user clicking this fixture's
.JPopupMenu
click
(MouseButton button) Simulates a user clicking this fixture's
.JPopupMenu
click
(MouseClickInfo mouseClickInfo) Simulates a user clicking this fixture's
.JPopupMenu
Simulates a user double-clicking this fixture's
.JPopupMenu
protected final void
driver
(JPopupMenuDriver newDriver) Sets the
to be used by this fixture.JPopupMenuDriver
focus()
Gives input focus to this fixture's
.JPopupMenu
Finds a
, contained in this fixture'sJMenuItem
, which name matches the specified one.JPopupMenu
menuItem
(GenericTypeMatcher<? extends JMenuItem> matcher) Finds a
, contained in this fixture'sJMenuItem
, that matches the specified search criteria.JPopupMenu
menuItemWithPath
(String... path) Finds a
in this fixture'sJMenuItem
, which path matches the given one.JPopupMenu
String[]
Returns the contents of this fixture's
.JPopupMenu
pressAndReleaseKey
(KeyPressInfo keyPressInfo) Simulates a user pressing given key with the given modifiers on this fixture's
.JPopupMenu
pressAndReleaseKeys
(int... keyCodes) Simulates a user pressing and releasing the given keys on this fixture's
.JPopupMenu
pressKey
(int keyCode) Simulates a user pressing the given key on this fixture's
.JPopupMenu
releaseKey
(int keyCode) Simulates a user releasing the given key on this fixture's
.JPopupMenu
Asserts that this fixture's
is disabled.JPopupMenu
Asserts that this fixture's
is enabled.JPopupMenu
requireEnabled
(Timeout timeout) Asserts that this fixture's
is enabled.JPopupMenu
Asserts that this fixture's
has input focus.JPopupMenu
Asserts that this fixture's
is not visible.JPopupMenu
Asserts that this fixture's
is visible.JPopupMenu
Simulates a user right-clicking this fixture's
.JPopupMenu
Methods inherited from class org.fest.swing.fixture.ComponentFixture
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNull
-
Field Details
-
driver
-
-
Constructor Details
-
JPopupMenuFixture
Creates a new
.JPopupMenuFixture
- Parameters:
robot
- performs simulation of user events on the givenJPopupMenu
.target
- theJPopupMenu
to be managed by this fixture.- Throws:
NullPointerException
- ifrobot
isnull
.NullPointerException
- iftarget
isnull
.
-
-
Method Details
-
driver
Sets the
to be used by this fixture.JPopupMenuDriver
- Parameters:
newDriver
- the newJPopupMenuDriver
.- Throws:
NullPointerException
- if the given driver isnull
.
-
click
Simulates a user clicking this fixture's
.JPopupMenu
- Specified by:
click
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJPopupMenu
is disabled.IllegalStateException
- if this fixture'sJPopupMenu
is not showing on the screen.
-
click
Simulates a user clicking this fixture's
.JPopupMenu
- Specified by:
click
in interfaceMouseInputSimulationFixture
- Parameters:
button
- the button to click.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the givenMouseButton
isnull
.IllegalStateException
- if this fixture'sJPopupMenu
is disabled.IllegalStateException
- if this fixture'sJPopupMenu
is not showing on the screen.
-
click
Simulates a user clicking this fixture's
.JPopupMenu
- Specified by:
click
in interfaceMouseInputSimulationFixture
- Parameters:
mouseClickInfo
- specifies the button to click and the times the button should be clicked.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the givenMouseClickInfo
isnull
.IllegalStateException
- if this fixture'sJPopupMenu
is disabled.IllegalStateException
- if this fixture'sJPopupMenu
is not showing on the screen.
-
rightClick
Simulates a user right-clicking this fixture's
.JPopupMenu
- Specified by:
rightClick
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJPopupMenu
is disabled.IllegalStateException
- if this fixture'sJPopupMenu
is not showing on the screen.
-
doubleClick
Simulates a user double-clicking this fixture's
.JPopupMenu
- Specified by:
doubleClick
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJPopupMenu
is disabled.IllegalStateException
- if this fixture'sJPopupMenu
is not showing on the screen.
-
focus
Gives input focus to this fixture's
.JPopupMenu
- Specified by:
focus
in interfaceFocusableComponentFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJPopupMenu
is disabled.IllegalStateException
- if this fixture'sJPopupMenu
is not showing on the screen.
-
pressAndReleaseKey
Simulates a user pressing given key with the given modifiers on this fixture's
. Modifiers is a mask from the availableJPopupMenu
masks.InputEvent
- Specified by:
pressAndReleaseKey
in interfaceKeyboardInputSimulationFixture
- Parameters:
keyPressInfo
- specifies the key and modifiers to press.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the givenKeyPressInfo
isnull
.IllegalArgumentException
- if the given code is not a valid key code.IllegalStateException
- if this fixture'sJPopupMenu
is disabled.IllegalStateException
- if this fixture'sJPopupMenu
is not showing on the screen.- See Also:
-
pressAndReleaseKeys
Simulates a user pressing and releasing the given keys on this fixture's
. This method does not affect the current focus.JPopupMenu
- Specified by:
pressAndReleaseKeys
in interfaceKeyboardInputSimulationFixture
- Parameters:
keyCodes
- one or more codes of the keys to press.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the given array of codes isnull
.IllegalArgumentException
- if any of the given code is not a valid key code.IllegalStateException
- if this fixture'sJPopupMenu
is disabled.IllegalStateException
- if this fixture'sJPopupMenu
is not showing on the screen.- See Also:
-
pressKey
Simulates a user pressing the given key on this fixture's
.JPopupMenu
- Specified by:
pressKey
in interfaceKeyboardInputSimulationFixture
- Parameters:
keyCode
- the code of the key to press.- Returns:
- this fixture.
- Throws:
IllegalArgumentException
- if any of the given code is not a valid key code.IllegalStateException
- if this fixture'sJPopupMenu
is disabled.IllegalStateException
- if this fixture'sJPopupMenu
is not showing on the screen.- See Also:
-
releaseKey
Simulates a user releasing the given key on this fixture's
.JPopupMenu
- Specified by:
releaseKey
in interfaceKeyboardInputSimulationFixture
- Parameters:
keyCode
- the code of the key to release.- Returns:
- this fixture.
- Throws:
IllegalArgumentException
- if any of the given code is not a valid key code.IllegalStateException
- if this fixture'sJPopupMenu
is disabled.IllegalStateException
- if this fixture'sJPopupMenu
is not showing on the screen.- See Also:
-
requireFocused
Asserts that this fixture's
has input focus.JPopupMenu
- Specified by:
requireFocused
in interfaceFocusableComponentFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJPopupMenu
does not have input focus.
-
requireEnabled
Asserts that this fixture's
is enabled.JPopupMenu
- Specified by:
requireEnabled
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJPopupMenu
is disabled.
-
requireEnabled
Asserts that this fixture's
is enabled.JPopupMenu
- Specified by:
requireEnabled
in interfaceStateVerificationFixture
- Parameters:
timeout
- the time this fixture will wait for the component to be enabled.- Returns:
- this fixture.
- Throws:
WaitTimedOutError
- if this fixture'sJPopupMenu
is never enabled.
-
requireDisabled
Asserts that this fixture's
is disabled.JPopupMenu
- Specified by:
requireDisabled
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJPopupMenu
is enabled.
-
requireVisible
Asserts that this fixture's
is visible.JPopupMenu
- Specified by:
requireVisible
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJPopupMenu
is not visible.
-
requireNotVisible
Asserts that this fixture's
is not visible.JPopupMenu
- Specified by:
requireNotVisible
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJPopupMenu
is visible.
-