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
JTabbedPane
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
ConstructorsConstructorDescriptionJTabbedPaneFixture
(Robot robot, String tabbedPaneName) Creates a new
.JTabbedPaneFixture
JTabbedPaneFixture
(Robot robot, JTabbedPane target) Creates a new
.JTabbedPaneFixture
-
Method Summary
Modifier and TypeMethodDescriptionclick()
Simulates a user clicking this fixture's
.JTabbedPane
click
(MouseButton button) Simulates a user clicking this fixture's
.JTabbedPane
click
(MouseClickInfo mouseClickInfo) Simulates a user clicking this fixture's
.JTabbedPane
clientProperty
(Object key) Returns the client property stored in this fixture's
, under the given key.JTabbedPane
private void
Simulates a user double-clicking this fixture's
.JTabbedPane
protected final void
driver
(JTabbedPaneDriver newDriver) Sets the
to be used by this fixture.JTabbedPaneDriver
focus()
Gives input focus to this fixture's
.JTabbedPane
pressAndReleaseKey
(KeyPressInfo keyPressInfo) Simulates a user pressing given key with the given modifiers on this fixture's
.JTabbedPane
pressAndReleaseKeys
(int... keyCodes) Simulates a user pressing and releasing the given keys on this fixture's
.JTabbedPane
pressKey
(int keyCode) Simulates a user pressing the given key on this fixture's
.JTabbedPane
releaseKey
(int keyCode) Simulates a user releasing the given key on this fixture's
.JTabbedPane
Asserts that this fixture's
is disabled.JTabbedPane
Asserts that this fixture's
is enabled.JTabbedPane
requireEnabled
(Timeout timeout) Asserts that this fixture's
is enabled.JTabbedPane
Asserts that this fixture's
has input focus.JTabbedPane
Asserts that this fixture's
is not visible.JTabbedPane
requireTabTitles
(String... titles) Asserts that the tabs of this fixture's
have the given titles.JTabbedPane
requireTitle
(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's
matches the given value.JTabbedPane
requireToolTip
(Pattern pattern) Asserts that the toolTip in this fixture's
matches the given regular expression pattern.JTabbedPane
Asserts that this fixture's
is visible.JTabbedPane
Simulates a user right-clicking this fixture's
.JTabbedPane
Returns the currently selected component for this fixture's
.JTabbedPane
selectTab
(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's
as the invoker of the pop-up menu.JTabbedPane
Shows a pop-up menu at the given point using this fixture's
as the invoker of the pop-up menu.JTabbedPane
String[]
Returns the titles of all the tabs in this fixture's
.JTabbedPane
Methods 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
- theJTabbedPane
to be managed by this fixture.- Throws:
NullPointerException
- ifrobot
isnull
.NullPointerException
- iftarget
isnull
.
-
JTabbedPaneFixture
Creates a new
.JTabbedPaneFixture
- Parameters:
robot
- performs simulation of user events on aJTabbedPane
.tabbedPaneName
- the name of theJTabbedPane
to find using the givenRobot
.- Throws:
NullPointerException
- ifrobot
isnull
.ComponentLookupException
- if a matchingJTabbedPane
could not be found.ComponentLookupException
- if more than one matchingJTabbedPane
is found.
-
-
Method Details
-
createDriver
private void createDriver() -
driver
Sets the
to 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'sJTabbedPane
is disabled.IllegalStateException
- if this fixture'sJTabbedPane
is not showing on the screen.IndexOutOfBoundsException
- if the given index is not within theJTabbedPane
bounds.
-
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'sJTabbedPane
is disabled.IllegalStateException
- if this fixture'sJTabbedPane
is 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'sJTabbedPane
is disabled.IllegalStateException
- if this fixture'sJTabbedPane
is 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:
click
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTabbedPane
is disabled.IllegalStateException
- if this fixture'sJTabbedPane
is not showing on the screen.
-
click
Simulates a user clicking this fixture's
.JTabbedPane
- Specified by:
click
in interfaceMouseInputSimulationFixture
- Parameters:
button
- the button to click.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the givenMouseButton
isnull
.IllegalStateException
- if this fixture'sJTabbedPane
is disabled.IllegalStateException
- if this fixture'sJTabbedPane
is not showing on the screen.
-
click
Simulates a user clicking this fixture's
.JTabbedPane
- 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'sJTabbedPane
is disabled.IllegalStateException
- if this fixture'sJTabbedPane
is not showing on the screen.
-
doubleClick
Simulates a user double-clicking this fixture's
.JTabbedPane
- Specified by:
doubleClick
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTabbedPane
is disabled.IllegalStateException
- if this fixture'sJTabbedPane
is not showing on the screen.
-
rightClick
Simulates a user right-clicking this fixture's
.JTabbedPane
- Specified by:
rightClick
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTabbedPane
is disabled.IllegalStateException
- if this fixture'sJTabbedPane
is not showing on the screen.
-
focus
Gives input focus to this fixture's
.JTabbedPane
- Specified by:
focus
in interfaceFocusableComponentFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTabbedPane
is disabled.IllegalStateException
- if this fixture'sJTabbedPane
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 availableJTabbedPane
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'sJTabbedPane
is disabled.IllegalStateException
- if this fixture'sJTabbedPane
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.JTabbedPane
- 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'sJTabbedPane
is disabled.IllegalStateException
- if this fixture'sJTabbedPane
is not showing on the screen.- See Also:
-
pressKey
Simulates a user pressing the given key on this fixture's
.JTabbedPane
- 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'sJTabbedPane
is disabled.IllegalStateException
- if this fixture'sJTabbedPane
is not showing on the screen.- See Also:
-
releaseKey
Simulates a user releasing the given key on this fixture's
.JTabbedPane
- 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'sJTabbedPane
is disabled.IllegalStateException
- if this fixture'sJTabbedPane
is not showing on the screen.- See Also:
-
requireFocused
Asserts that this fixture's
has input focus.JTabbedPane
- Specified by:
requireFocused
in interfaceFocusableComponentFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJTabbedPane
does not have input focus.
-
requireEnabled
Asserts that this fixture's
is enabled.JTabbedPane
- Specified by:
requireEnabled
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJTabbedPane
is disabled.
-
requireEnabled
Asserts that this fixture's
is enabled.JTabbedPane
- 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'sJTabbedPane
is never enabled.
-
requireDisabled
Asserts that this fixture's
is disabled.JTabbedPane
- Specified by:
requireDisabled
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJTabbedPane
is enabled.
-
requireVisible
Asserts that this fixture's
is visible.JTabbedPane
- Specified by:
requireVisible
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJTabbedPane
is not visible.
-
requireNotVisible
Asserts that this fixture's
is not visible.JTabbedPane
- Specified by:
requireNotVisible
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJTabbedPane
is 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 theJTabbedPane
bounds.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's
have 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's
matches the given value.JTabbedPane
- Specified by:
requireToolTip
in interfaceToolTipDisplayFixture
- Parameters:
expected
- the given value. It can be a regular expression.- Returns:
- this fixture.
- Throws:
AssertionError
- if the toolTip in this fixture'sJTabbedPane
does not match the given value.- Since:
- 1.2
-
requireToolTip
Asserts that the toolTip in this fixture's
matches the given regular expression pattern.JTabbedPane
- Specified by:
requireToolTip
in 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'sJTabbedPane
does 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:
clientProperty
in 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
null
if the property was not found. - Throws:
NullPointerException
- if the given key isnull
.- Since:
- 1.2
-
showPopupMenu
Shows a pop-up menu using this fixture's
as the invoker of the pop-up menu.JTabbedPane
- Specified by:
showPopupMenu
in interfaceJPopupMenuInvokerFixture
- Returns:
- a fixture that manages the displayed pop-up menu.
- Throws:
IllegalStateException
- if this fixture'sJTabbedPane
is disabled.IllegalStateException
- if this fixture'sJTabbedPane
is 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's
as the invoker of the pop-up menu.JTabbedPane
- Specified by:
showPopupMenuAt
in 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'sJTabbedPane
is disabled.IllegalStateException
- if this fixture'sJTabbedPane
is not showing on the screen.ComponentLookupException
- if a pop-up menu cannot be found.
-