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
JPopupMenus:
- 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.JPopupMenuclick(MouseButton button) Simulates a user clicking this fixture's.JPopupMenuclick(MouseClickInfo mouseClickInfo) Simulates a user clicking this fixture's.JPopupMenuSimulates a user double-clicking this fixture's.JPopupMenuprotected final voiddriver(JPopupMenuDriver newDriver) Sets theto be used by this fixture.JPopupMenuDriverfocus()Gives input focus to this fixture's.JPopupMenuFinds a, contained in this fixture'sJMenuItem, which name matches the specified one.JPopupMenumenuItem(GenericTypeMatcher<? extends JMenuItem> matcher) Finds a, contained in this fixture'sJMenuItem, that matches the specified search criteria.JPopupMenumenuItemWithPath(String... path) Finds ain this fixture'sJMenuItem, which path matches the given one.JPopupMenuString[]Returns the contents of this fixture's.JPopupMenupressAndReleaseKey(KeyPressInfo keyPressInfo) Simulates a user pressing given key with the given modifiers on this fixture's.JPopupMenupressAndReleaseKeys(int... keyCodes) Simulates a user pressing and releasing the given keys on this fixture's.JPopupMenupressKey(int keyCode) Simulates a user pressing the given key on this fixture's.JPopupMenureleaseKey(int keyCode) Simulates a user releasing the given key on this fixture's.JPopupMenuAsserts that this fixture'sis disabled.JPopupMenuAsserts that this fixture'sis enabled.JPopupMenurequireEnabled(Timeout timeout) Asserts that this fixture'sis enabled.JPopupMenuAsserts that this fixture'shas input focus.JPopupMenuAsserts that this fixture'sis not visible.JPopupMenuAsserts that this fixture'sis visible.JPopupMenuSimulates a user right-clicking this fixture's.JPopupMenuMethods 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- theJPopupMenuto be managed by this fixture.- Throws:
NullPointerException- ifrobotisnull.NullPointerException- iftargetisnull.
-
-
Method Details
-
driver
Sets theto 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:
clickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJPopupMenuis disabled.IllegalStateException- if this fixture'sJPopupMenuis not showing on the screen.
-
click
Simulates a user clicking this fixture's.JPopupMenu- Specified by:
clickin interfaceMouseInputSimulationFixture- Parameters:
button- the button to click.- Returns:
- this fixture.
- Throws:
NullPointerException- if the givenMouseButtonisnull.IllegalStateException- if this fixture'sJPopupMenuis disabled.IllegalStateException- if this fixture'sJPopupMenuis not showing on the screen.
-
click
Simulates a user clicking this fixture's.JPopupMenu- Specified by:
clickin interfaceMouseInputSimulationFixture- Parameters:
mouseClickInfo- specifies the button to click and the times the button should be clicked.- Returns:
- this fixture.
- Throws:
NullPointerException- if the givenMouseClickInfoisnull.IllegalStateException- if this fixture'sJPopupMenuis disabled.IllegalStateException- if this fixture'sJPopupMenuis not showing on the screen.
-
rightClick
Simulates a user right-clicking this fixture's.JPopupMenu- Specified by:
rightClickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJPopupMenuis disabled.IllegalStateException- if this fixture'sJPopupMenuis not showing on the screen.
-
doubleClick
Simulates a user double-clicking this fixture's.JPopupMenu- Specified by:
doubleClickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJPopupMenuis disabled.IllegalStateException- if this fixture'sJPopupMenuis not showing on the screen.
-
focus
Gives input focus to this fixture's.JPopupMenu- Specified by:
focusin interfaceFocusableComponentFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJPopupMenuis disabled.IllegalStateException- if this fixture'sJPopupMenuis 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 availableJPopupMenumasks.InputEvent- Specified by:
pressAndReleaseKeyin interfaceKeyboardInputSimulationFixture- Parameters:
keyPressInfo- specifies the key and modifiers to press.- Returns:
- this fixture.
- Throws:
NullPointerException- if the givenKeyPressInfoisnull.IllegalArgumentException- if the given code is not a valid key code.IllegalStateException- if this fixture'sJPopupMenuis disabled.IllegalStateException- if this fixture'sJPopupMenuis 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:
pressAndReleaseKeysin 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'sJPopupMenuis disabled.IllegalStateException- if this fixture'sJPopupMenuis not showing on the screen.- See Also:
-
pressKey
Simulates a user pressing the given key on this fixture's.JPopupMenu- Specified by:
pressKeyin 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'sJPopupMenuis disabled.IllegalStateException- if this fixture'sJPopupMenuis not showing on the screen.- See Also:
-
releaseKey
Simulates a user releasing the given key on this fixture's.JPopupMenu- Specified by:
releaseKeyin 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'sJPopupMenuis disabled.IllegalStateException- if this fixture'sJPopupMenuis not showing on the screen.- See Also:
-
requireFocused
Asserts that this fixture'shas input focus.JPopupMenu- Specified by:
requireFocusedin interfaceFocusableComponentFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJPopupMenudoes not have input focus.
-
requireEnabled
Asserts that this fixture'sis enabled.JPopupMenu- Specified by:
requireEnabledin interfaceStateVerificationFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJPopupMenuis disabled.
-
requireEnabled
Asserts that this fixture'sis enabled.JPopupMenu- Specified by:
requireEnabledin interfaceStateVerificationFixture- Parameters:
timeout- the time this fixture will wait for the component to be enabled.- Returns:
- this fixture.
- Throws:
WaitTimedOutError- if this fixture'sJPopupMenuis never enabled.
-
requireDisabled
Asserts that this fixture'sis disabled.JPopupMenu- Specified by:
requireDisabledin interfaceStateVerificationFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJPopupMenuis enabled.
-
requireVisible
Asserts that this fixture'sis visible.JPopupMenu- Specified by:
requireVisiblein interfaceStateVerificationFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJPopupMenuis not visible.
-
requireNotVisible
Asserts that this fixture'sis not visible.JPopupMenu- Specified by:
requireNotVisiblein interfaceStateVerificationFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJPopupMenuis visible.
-