Package org.fest.swing.fixture
Class JTabbedPaneFixture
- All Implemented Interfaces:
ClientPropertyStorageFixture,CommonComponentFixture,FocusableComponentFixture,JComponentFixture,JPopupMenuInvokerFixture,KeyboardInputSimulationFixture,MouseInputSimulationFixture,StateVerificationFixture,ToolTipDisplayFixture
public class JTabbedPaneFixture
extends ComponentFixture<JTabbedPane>
implements CommonComponentFixture, JComponentFixture, JPopupMenuInvokerFixture
Understands functional testing of
JTabbedPanes:
- 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
ConstructorsConstructorDescriptionJTabbedPaneFixture(Robot robot, String tabbedPaneName) Creates a new.JTabbedPaneFixtureJTabbedPaneFixture(Robot robot, JTabbedPane target) Creates a new.JTabbedPaneFixture -
Method Summary
Modifier and TypeMethodDescriptionclick()Simulates a user clicking this fixture's.JTabbedPaneclick(MouseButton button) Simulates a user clicking this fixture's.JTabbedPaneclick(MouseClickInfo mouseClickInfo) Simulates a user clicking this fixture's.JTabbedPaneclientProperty(Object key) Returns the client property stored in this fixture's, under the given key.JTabbedPaneprivate voidSimulates a user double-clicking this fixture's.JTabbedPaneprotected final voiddriver(JTabbedPaneDriver newDriver) Sets theto be used by this fixture.JTabbedPaneDriverfocus()Gives input focus to this fixture's.JTabbedPanepressAndReleaseKey(KeyPressInfo keyPressInfo) Simulates a user pressing given key with the given modifiers on this fixture's.JTabbedPanepressAndReleaseKeys(int... keyCodes) Simulates a user pressing and releasing the given keys on this fixture's.JTabbedPanepressKey(int keyCode) Simulates a user pressing the given key on this fixture's.JTabbedPanereleaseKey(int keyCode) Simulates a user releasing the given key on this fixture's.JTabbedPaneAsserts that this fixture'sis disabled.JTabbedPaneAsserts that this fixture'sis enabled.JTabbedPanerequireEnabled(Timeout timeout) Asserts that this fixture'sis enabled.JTabbedPaneAsserts that this fixture'shas input focus.JTabbedPaneAsserts that this fixture'sis not visible.JTabbedPanerequireTabTitles(String... titles) Asserts that the tabs of this fixture'shave the given titles.JTabbedPanerequireTitle(String title, Index index) Asserts that the title of the tab at the given index matches the given value.requireTitle(Pattern pattern, Index index) Asserts that the title of the tab at the given index matches the given regular expression pattern.requireToolTip(String expected) Asserts that the toolTip in this fixture'smatches the given value.JTabbedPanerequireToolTip(Pattern pattern) Asserts that the toolTip in this fixture'smatches the given regular expression pattern.JTabbedPaneAsserts that this fixture'sis visible.JTabbedPaneSimulates a user right-clicking this fixture's.JTabbedPaneReturns the currently selected component for this fixture's.JTabbedPaneselectTab(int index) Simulates a user selecting the tab located at the given index.Simulates a user selecting the tab whose title matches the given value.Simulates a user selecting the tab whose title matches the given regular expression pattern.Shows a pop-up menu using this fixture'sas the invoker of the pop-up menu.JTabbedPaneShows a pop-up menu at the given point using this fixture'sas the invoker of the pop-up menu.JTabbedPaneString[]Returns the titles of all the tabs in this fixture's.JTabbedPaneMethods inherited from class org.fest.swing.fixture.ComponentFixture
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNull
-
Field Details
-
driver
-
-
Constructor Details
-
JTabbedPaneFixture
Creates a new.JTabbedPaneFixture- Parameters:
robot- performs simulation of user events on the givenJTabbedPane.target- theJTabbedPaneto be managed by this fixture.- Throws:
NullPointerException- ifrobotisnull.NullPointerException- iftargetisnull.
-
JTabbedPaneFixture
Creates a new.JTabbedPaneFixture- Parameters:
robot- performs simulation of user events on aJTabbedPane.tabbedPaneName- the name of theJTabbedPaneto find using the givenRobot.- Throws:
NullPointerException- ifrobotisnull.ComponentLookupException- if a matchingJTabbedPanecould not be found.ComponentLookupException- if more than one matchingJTabbedPaneis found.
-
-
Method Details
-
createDriver
private void createDriver() -
driver
Sets theto be used by this fixture.JTabbedPaneDriver- Parameters:
newDriver- the newJTabbedPaneDriver.- Throws:
NullPointerException- if the given driver isnull.
-
tabTitles
Returns the titles of all the tabs in this fixture's.JTabbedPane- Returns:
- the titles of all the tabs.
-
selectTab
Simulates a user selecting the tab located at the given index.- Parameters:
index- the index of the tab to select.- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJTabbedPaneis disabled.IllegalStateException- if this fixture'sJTabbedPaneis not showing on the screen.IndexOutOfBoundsException- if the given index is not within theJTabbedPanebounds.
-
selectTab
Simulates a user selecting the tab whose title matches the given value.- Parameters:
title- the title to match. It can be a regular expression.- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJTabbedPaneis disabled.IllegalStateException- if this fixture'sJTabbedPaneis not showing on the screen.LocationUnavailableException- if a tab matching the given title could not be found.
-
selectTab
Simulates a user selecting the tab whose title matches the given regular expression pattern.- Parameters:
pattern- the regular expression pattern to match.- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJTabbedPaneis disabled.IllegalStateException- if this fixture'sJTabbedPaneis not showing on the screen.NullPointerException- if the given regular expression pattern isnull.LocationUnavailableException- if a tab matching the given regular expression pattern could not be found.- Since:
- 1.2
-
selectedComponent
Returns the currently selected component for this fixture's.JTabbedPane- Returns:
- the currently selected component for this fixture's
JTabbedPane.
-
click
Simulates a user clicking this fixture's.JTabbedPane- Specified by:
clickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJTabbedPaneis disabled.IllegalStateException- if this fixture'sJTabbedPaneis not showing on the screen.
-
click
Simulates a user clicking this fixture's.JTabbedPane- Specified by:
clickin interfaceMouseInputSimulationFixture- Parameters:
button- the button to click.- Returns:
- this fixture.
- Throws:
NullPointerException- if the givenMouseButtonisnull.IllegalStateException- if this fixture'sJTabbedPaneis disabled.IllegalStateException- if this fixture'sJTabbedPaneis not showing on the screen.
-
click
Simulates a user clicking this fixture's.JTabbedPane- 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'sJTabbedPaneis disabled.IllegalStateException- if this fixture'sJTabbedPaneis not showing on the screen.
-
doubleClick
Simulates a user double-clicking this fixture's.JTabbedPane- Specified by:
doubleClickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJTabbedPaneis disabled.IllegalStateException- if this fixture'sJTabbedPaneis not showing on the screen.
-
rightClick
Simulates a user right-clicking this fixture's.JTabbedPane- Specified by:
rightClickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJTabbedPaneis disabled.IllegalStateException- if this fixture'sJTabbedPaneis not showing on the screen.
-
focus
Gives input focus to this fixture's.JTabbedPane- Specified by:
focusin interfaceFocusableComponentFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJTabbedPaneis disabled.IllegalStateException- if this fixture'sJTabbedPaneis 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 availableJTabbedPanemasks.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'sJTabbedPaneis disabled.IllegalStateException- if this fixture'sJTabbedPaneis 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.JTabbedPane- 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'sJTabbedPaneis disabled.IllegalStateException- if this fixture'sJTabbedPaneis not showing on the screen.- See Also:
-
pressKey
Simulates a user pressing the given key on this fixture's.JTabbedPane- 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'sJTabbedPaneis disabled.IllegalStateException- if this fixture'sJTabbedPaneis not showing on the screen.- See Also:
-
releaseKey
Simulates a user releasing the given key on this fixture's.JTabbedPane- 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'sJTabbedPaneis disabled.IllegalStateException- if this fixture'sJTabbedPaneis not showing on the screen.- See Also:
-
requireFocused
Asserts that this fixture'shas input focus.JTabbedPane- Specified by:
requireFocusedin interfaceFocusableComponentFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJTabbedPanedoes not have input focus.
-
requireEnabled
Asserts that this fixture'sis enabled.JTabbedPane- Specified by:
requireEnabledin interfaceStateVerificationFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJTabbedPaneis disabled.
-
requireEnabled
Asserts that this fixture'sis enabled.JTabbedPane- 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'sJTabbedPaneis never enabled.
-
requireDisabled
Asserts that this fixture'sis disabled.JTabbedPane- Specified by:
requireDisabledin interfaceStateVerificationFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJTabbedPaneis enabled.
-
requireVisible
Asserts that this fixture'sis visible.JTabbedPane- Specified by:
requireVisiblein interfaceStateVerificationFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJTabbedPaneis not visible.
-
requireNotVisible
Asserts that this fixture'sis not visible.JTabbedPane- Specified by:
requireNotVisiblein interfaceStateVerificationFixture- Returns:
- this fixture.
- Throws:
AssertionError- if this fixture'sJTabbedPaneis visible.
-
requireTitle
Asserts that the title of the tab at the given index matches the given value.- Parameters:
title- the expected title. It can be a regular expression.index- the index of the tab.- Returns:
- this fixture.
- Throws:
IndexOutOfBoundsException- if the given index is not within theJTabbedPanebounds.AssertionError- if the title of the tab at the given index does not match the given one.
-
requireTitle
Asserts that the title of the tab at the given index matches the given regular expression pattern.- Parameters:
pattern- the regular expression pattern to match.index- the index of the tab.- Returns:
- this fixture.
- Throws:
NullPointerException- if the given regular expression pattern isnull.AssertionError- if the title of the tab at the given index does not match the given regular expression pattern.
-
requireTabTitles
Asserts that the tabs of this fixture'shave the given titles. The tab titles are evaluated by index order, for example, the first tab is expected to have the first title in the given array, and so on.JTabbedPane- Parameters:
titles- the expected titles.- Returns:
- this fixture.
- Throws:
AssertionError- if the title of any of the tabs is not equal to the expected titles.
-
requireToolTip
Asserts that the toolTip in this fixture'smatches the given value.JTabbedPane- Specified by:
requireToolTipin interfaceToolTipDisplayFixture- Parameters:
expected- the given value. It can be a regular expression.- Returns:
- this fixture.
- Throws:
AssertionError- if the toolTip in this fixture'sJTabbedPanedoes not match the given value.- Since:
- 1.2
-
requireToolTip
Asserts that the toolTip in this fixture'smatches the given regular expression pattern.JTabbedPane- Specified by:
requireToolTipin interfaceToolTipDisplayFixture- Parameters:
pattern- the regular expression pattern to match.- Returns:
- this fixture.
- Throws:
NullPointerException- if the given regular expression pattern isnull.AssertionError- if the toolTip in this fixture'sJTabbedPanedoes not match the given regular expression pattern.- Since:
- 1.2
-
clientProperty
Returns the client property stored in this fixture's, under the given key.JTabbedPane- Specified by:
clientPropertyin interfaceClientPropertyStorageFixture- Parameters:
key- the key to use to retrieve the client property.- Returns:
- the value of the client property stored under the given key, or
nullif the property was not found. - Throws:
NullPointerException- if the given key isnull.- Since:
- 1.2
-
showPopupMenu
Shows a pop-up menu using this fixture'sas the invoker of the pop-up menu.JTabbedPane- Specified by:
showPopupMenuin interfaceJPopupMenuInvokerFixture- Returns:
- a fixture that manages the displayed pop-up menu.
- Throws:
IllegalStateException- if this fixture'sJTabbedPaneis disabled.IllegalStateException- if this fixture'sJTabbedPaneis not showing on the screen.ComponentLookupException- if a pop-up menu cannot be found.
-
showPopupMenuAt
Shows a pop-up menu at the given point using this fixture'sas the invoker of the pop-up menu.JTabbedPane- Specified by:
showPopupMenuAtin interfaceJPopupMenuInvokerFixture- Parameters:
p- the given point where to show the pop-up menu.- Returns:
- a fixture that manages the displayed pop-up menu.
- Throws:
IllegalStateException- if this fixture'sJTabbedPaneis disabled.IllegalStateException- if this fixture'sJTabbedPaneis not showing on the screen.ComponentLookupException- if a pop-up menu cannot be found.
-