@InternalApi public class JTabbedPaneDriver extends JComponentDriver
Supports functional testing of JTabbedPane
s.
Note: This class is intended for internal use only. Please use the classes in the package
org.assertj.swing.fixture
in your tests.
robot
Constructor and Description |
---|
JTabbedPaneDriver(Robot robot)
Creates a new
JTabbedPaneDriver . |
Modifier and Type | Method and Description |
---|---|
void |
requireSelectedTab(JTabbedPane tabbedPane,
Index index)
Asserts that the tab at the given index is the selected tab.
|
void |
requireTabDisabled(JTabbedPane tabbedPane,
Index index)
Asserts that the tab at the given index is disabled.
|
void |
requireTabEnabled(JTabbedPane tabbedPane,
Index index)
Asserts that the tab at the given index is enabled.
|
void |
requireTabTitle(JTabbedPane tabbedPane,
Pattern pattern,
Index index)
Asserts that the title of the tab at the given index matches the given regular expression pattern.
|
void |
requireTabTitle(JTabbedPane tabbedPane,
String title,
Index index)
Asserts that the title of the tab at the given index matches the given value.
|
void |
requireTabTitles(JTabbedPane tabbedPane,
String[] titles)
Asserts that the tabs of the given
JTabbedPane have the given titles. |
void |
requireTabToolTipText(JTabbedPane tabbedPane,
Pattern pattern,
Index index)
Asserts that the toolTipText of the tab at the given index matches the given regular expression pattern.
|
void |
requireTabToolTipText(JTabbedPane tabbedPane,
String toolTipText,
Index index)
Asserts that the toolTipText of the tab at the given index matches the given value.
|
Component |
selectedComponentOf(JTabbedPane tabbedPane)
Returns the currently selected component for the given
JTabbedPane . |
void |
selectTab(JTabbedPane tabbedPane,
int index)
Simulates a user selecting the tab located at the given index.
|
void |
selectTab(JTabbedPane tabbedPane,
Pattern pattern)
Simulates a user selecting the tab whose title matches the given regular expression pattern.
|
void |
selectTab(JTabbedPane tabbedPane,
String title)
Simulates a user selecting the tab containing the given title.
|
String[] |
tabTitles(JTabbedPane tabbedPane)
Returns the titles of all the tabs.
|
clientProperty, invokeAction, isVisible, isVisible, requireToolTip, requireToolTip, scrollToVisible
doResizeHeight, doResizeWidth, isResizable, move, resize
backgroundOf, checkClickAllowed, checkInEdtEnabledAndShowing, checkInEdtShowing, click, click, click, click, click, doubleClick, drag, dragOver, drop, drop, focus, focusAndWaitForFocusGain, fontOf, foregroundOf, invokePopupMenu, invokePopupMenu, moveMouseIgnoringAnyError, moveMouseIgnoringAnyError, performAccessibleActionOf, pressAndReleaseKey, pressAndReleaseKey, pressAndReleaseKeys, pressKey, pressKeyWhileRunning, propertyName, releaseKey, requireDisabled, requireEnabled, requireEnabled, requireFocused, requireNotVisible, requireSize, requireVisible, rightClick, settings, waitForShowing
public JTabbedPaneDriver(@Nonnull Robot robot)
JTabbedPaneDriver
.robot
- the robot to use to simulate user input.@RunsInEDT @Nonnull public String[] tabTitles(@Nonnull JTabbedPane tabbedPane)
tabbedPane
- the target JTabbedPane
.@RunsInEDT public void selectTab(@Nonnull JTabbedPane tabbedPane, @Nullable String title)
tabbedPane
- the target JTabbedPane
.title
- the given text to match. It can be a regular expression.IllegalStateException
- if the JTabbedPane
is disabled.IllegalStateException
- if the JTabbedPane
is not showing on the screen.LocationUnavailableException
- if a tab matching the given title could not be found.@RunsInEDT public void selectTab(@Nonnull JTabbedPane tabbedPane, @Nonnull Pattern pattern)
tabbedPane
- the target JTabbedPane
.pattern
- the regular expression pattern to match.IllegalStateException
- if the JTabbedPane
is disabled.IllegalStateException
- if the JTabbedPane
is not showing on the screen.NullPointerException
- if the given regular expression pattern is null
.LocationUnavailableException
- if a tab matching the given regular expression pattern could not be found.@RunsInEDT public void selectTab(@Nonnull JTabbedPane tabbedPane, int index)
tabbedPane
- the target JTabbedPane
.index
- the index of the tab to select.IllegalStateException
- if the JTabbedPane
is disabled.IllegalStateException
- if the JTabbedPane
is not showing on the screen.IndexOutOfBoundsException
- if the given index is not within the JTabbedPane
bounds.@RunsInEDT @Nullable public Component selectedComponentOf(@Nonnull JTabbedPane tabbedPane)
JTabbedPane
.tabbedPane
- the target JTabbedPane
.JTabbedPane
.@RunsInEDT public void requireTabTitle(@Nonnull JTabbedPane tabbedPane, @Nullable String title, @Nonnull Index index)
tabbedPane
- the target JTabbedPane
.title
- the expected title. It can be a regular expression.index
- the index of the tab.IndexOutOfBoundsException
- if the given index is not within the JTabbedPane
bounds.AssertionError
- if the title of the tab at the given index does not match the given one.@RunsInEDT public void requireTabTitle(@Nonnull JTabbedPane tabbedPane, @Nonnull Pattern pattern, @Nonnull Index index)
tabbedPane
- the target JTabbedPane
.pattern
- the regular expression pattern to match.index
- the index of the tab.NullPointerException
- if the given regular expression pattern is null
.IndexOutOfBoundsException
- if the given index is not within the JTabbedPane
bounds.AssertionError
- if the title of the tab at the given index does not match the given one.@RunsInEDT public void requireSelectedTab(@Nonnull JTabbedPane tabbedPane, @Nonnull Index index)
tabbedPane
- the target JTabbedPane
.index
- the index of the selected tab.AssertionError
- if the index of the selected tab does not match the given one.@RunsInEDT public void requireTabToolTipText(@Nonnull JTabbedPane tabbedPane, @Nullable String toolTipText, @Nonnull Index index)
tabbedPane
- the target JTabbedPane
.toolTipText
- the expected toolTipText. It can be a regular expression.index
- the index of the tab.IndexOutOfBoundsException
- if the given index is not within the JTabbedPane
bounds.AssertionError
- if the toolTipText of the tab at the given index does not match the given one.@RunsInEDT public void requireTabToolTipText(@Nonnull JTabbedPane tabbedPane, @Nonnull Pattern pattern, @Nonnull Index index)
tabbedPane
- the target JTabbedPane
.pattern
- the regular expression pattern to match.index
- the index of the tab.NullPointerException
- if the given regular expression pattern is null
.IndexOutOfBoundsException
- if the given index is not within the JTabbedPane
bounds.AssertionError
- if the toolTipText of the tab at the given index does not match the given one.@RunsInEDT public void requireTabEnabled(@Nonnull JTabbedPane tabbedPane, @Nonnull Index index)
tabbedPane
- the target JTabbedPane
.index
- the index of the tab.IndexOutOfBoundsException
- if the given index is not within the JTabbedPane
bounds.AssertionError
- if the tab at the given index is not enabled.@RunsInEDT public void requireTabDisabled(@Nonnull JTabbedPane tabbedPane, @Nonnull Index index)
tabbedPane
- the target JTabbedPane
.index
- the index of the tab.IndexOutOfBoundsException
- if the given index is not within the JTabbedPane
bounds.AssertionError
- if the tab at the given index is not disabled.@RunsInEDT public void requireTabTitles(@Nonnull JTabbedPane tabbedPane, @Nonnull String[] titles)
JTabbedPane
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.tabbedPane
- the target JTabbedPane
.titles
- the expected titles.AssertionError
- if the title of any of the tabs is not equal to the expected titles.Copyright © 2014–2019 AssertJ. All rights reserved.