Package org.fest.swing.fixture
Class JTreeFixture
- All Implemented Interfaces:
ClientPropertyStorageFixture
,CommonComponentFixture
,FocusableComponentFixture
,JComponentFixture
,JPopupMenuInvokerFixture
,KeyboardInputSimulationFixture
,MouseInputSimulationFixture
,StateVerificationFixture
,ToolTipDisplayFixture
public class JTreeFixture
extends ComponentFixture<JTree>
implements CommonComponentFixture, JComponentFixture, JPopupMenuInvokerFixture
Understands functional testing of
JTree
s:
- user input simulation
- state verification
- property value query
s can be specified using TreePath
String
s. For example, for the following
tree:
root
|
-- node1
|
-- node1.1
we can identify the node "node1.1" as follows:
root/node1/node1.1
The default path separator is "/". It can be changed by calling
.
separator(String)
The conversion between the values given in tests and the values being displayed by a
renderer is performed by a JTree
. This fixture uses a
JTreeCellReader
by default.
BasicJTreeCellReader
-
Field Summary
FieldsFields inherited from class org.fest.swing.fixture.ComponentFixture
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target
-
Constructor Summary
ConstructorsConstructorDescriptionJTreeFixture
(Robot robot, String treeName) Creates a new
.JTreeFixture
JTreeFixture
(Robot robot, JTree target) Creates a new
.JTreeFixture
-
Method Summary
Modifier and TypeMethodDescriptioncellReader
(JTreeCellReader cellReader) Updates the implementation of
to use when comparing internal values of aJTreeCellReader
and the values expected in a test.JTree
click()
Simulates a user clicking this fixture's
.JTree
click
(MouseButton button) Simulates a user clicking this fixture's
.JTree
click
(MouseClickInfo mouseClickInfo) Simulates a user clicking this fixture's
.JTree
Clicks the given path, expanding parent nodes if necessary.clickPath
(String path, MouseButton button) Clicks the given path, expanding parent nodes if necessary.clickPath
(String path, MouseClickInfo mouseClickInfo) Clicks the given path, expanding parent nodes if necessary.clickRow
(int row) Clicks the given row.clickRow
(int row, MouseButton button) Clicks the given row.clickRow
(int row, MouseClickInfo mouseClickInfo) Clicks the given row.clientProperty
(Object key) Returns the client property stored in this fixture's
, under the given key.JButton
collapsePath
(String path) Simulates a user collapsing the tree node at the given path.collapseRow
(int row) Simulates a user collapsing the tree node at the given row.private void
Simulates a user double-clicking this fixture's
.JTree
doubleClickPath
(String path) Double-clicks the given path.doubleClickRow
(int row) Double-clicks the given row.drag
(int row) Simulates a user dragging a row from this fixture's
.JTree
Simulates a user dragging an item from this fixture's
.JTree
protected final void
driver
(JTreeDriver newDriver) Sets the
to be used by this fixture.JTreeDriver
drop
(int row) Simulates a user dropping an item into this fixture's
.JTree
Simulates a user dropping an item into this fixture's
.JTree
expandPath
(String path) Simulates a user expanding the tree node at the given path.expandRow
(int row) Simulates a user expanding the tree node at the given row.focus()
Gives input focus to this fixture's
.JTree
node
(int row) Returns a fixture that manages the node specified by the given row.Returns a fixture that manages the node specified by the given path.pressAndReleaseKey
(KeyPressInfo keyPressInfo) Simulates a user pressing given key with the given modifiers on this fixture's
.JTree
pressAndReleaseKeys
(int... keyCodes) Simulates a user pressing and releasing the given keys in this fixture's
.JTree
pressKey
(int keyCode) Simulates a user pressing the given key on this fixture's
.JTree
releaseKey
(int keyCode) Simulates a user releasing the given key on this fixture's
.JTree
Asserts that this fixture's
is disabled.JTree
Asserts that this fixture's
is editable.JTree
Asserts that this fixture's
is enabled.JTree
requireEnabled
(Timeout timeout) Asserts that this fixture's
is enabled.JTree
Asserts that this fixture's
has input focus.JTree
Asserts that this fixture's
's does not have any selection.JTree
Asserts that this fixture's
is not editable.JTree
Asserts that this fixture's
is not visible.JTree
requireSelection
(int... rows) Asserts that this fixture's
's selected rows are equal to the given one.JTree
requireSelection
(String... paths) Asserts that this fixture's
selection is equal to the given paths.JTree
requireToolTip
(String expected) Asserts that the toolTip in this fixture's
matches the given value.JTree
requireToolTip
(Pattern pattern) Asserts that the toolTip in this fixture's
matches the given regular expression pattern.JTree
Asserts that this fixture's
is visible.JTree
Simulates a user right-clicking this fixture's
.JTree
rightClickPath
(String path) Right-clicks the given path, expanding parent nodes if necessary.rightClickRow
(int row) Right-clicks the given row.selectPath
(String path) Selects the given path, expanding parent nodes if necessary.selectPaths
(String... paths) Select the given paths, expanding parent nodes if necessary.selectRow
(int row) Simulates a user selecting the tree node at the given row.selectRows
(int... rows) Simulates a user selecting the tree nodes at the given rows.Returns the separator to use when converting
s toTreePath
String
s.Updates the separator to use when converting
s toTreePath
String
s.Shows a pop-up menu using this fixture's
as the invoker of the pop-up menu.JTree
showPopupMenuAt
(int row) Shows a pop-up menu at the position of the node in the given row.Shows a pop-up menu at the given point using this fixture's
as the invoker of the pop-up menu.JTree
showPopupMenuAt
(String path) Shows a pop-up menu at the position of the last node in the given path.toggleRow
(int row) Simulates a user toggling the open/closed state of the tree node at the given row.valueAt
(int row) Returns theString
representation of the given row.Returns theString
representation of the node at the given path.Methods inherited from class org.fest.swing.fixture.ComponentFixture
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNull
-
Field Details
-
driver
-
-
Constructor Details
-
JTreeFixture
Creates a new
.JTreeFixture
- Parameters:
robot
- performs simulation of user events on the givenJTree
.target
- theJTree
to be managed by this fixture.- Throws:
NullPointerException
- ifrobot
isnull
.NullPointerException
- iftarget
isnull
.
-
JTreeFixture
Creates a new
.JTreeFixture
- Parameters:
robot
- performs simulation of user events on aJTree
.treeName
- the name of theJTree
to find using the givenRobot
.- Throws:
NullPointerException
- ifrobot
isnull
.ComponentLookupException
- if a matchingJTree
could not be found.ComponentLookupException
- if more than one matchingJTree
is found.
-
-
Method Details
-
createDriver
private void createDriver() -
driver
Sets the
to be used by this fixture.JTreeDriver
- Parameters:
newDriver
- the newJTreeDriver
.- Throws:
NullPointerException
- if the given driver isnull
.
-
clickRow
Clicks the given row.- Parameters:
row
- the given row.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if theJTree
is disabled.IllegalStateException
- if theJTree
is not showing on the screen.IndexOutOfBoundsException
- if the given row is less than zero or equal than or greater than the number of visible rows in theJTree
.LocationUnavailableException
- if a tree path for the given row cannot be found.- Since:
- 1.2
-
clickRow
Clicks the given row.- Parameters:
row
- the given row.button
- the mouse button to use.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the button isnull
.IllegalStateException
- if theJTree
is disabled.IllegalStateException
- if theJTree
is not showing on the screen.IndexOutOfBoundsException
- if the given row is less than zero or equal than or greater than the number of visible rows in theJTree
.LocationUnavailableException
- if a tree path for the given row cannot be found.- Since:
- 1.2
-
clickRow
Clicks the given row.- Parameters:
row
- the given row.mouseClickInfo
- specifies the mouse button to use and how many times to click.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the givenMouseClickInfo
isnull
.IllegalStateException
- if theJTree
is disabled.IllegalStateException
- if theJTree
is not showing on the screen.IndexOutOfBoundsException
- if the given row is less than zero or equal than or greater than the number of visible rows in theJTree
.LocationUnavailableException
- if a tree path for the given row cannot be found.- Since:
- 1.2
-
clickPath
Clicks the given path, expanding parent nodes if necessary.- Parameters:
path
- the given path.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.LocationUnavailableException
- if the given path cannot be found.
-
clickPath
Clicks the given path, expanding parent nodes if necessary.- Parameters:
path
- the given path.button
- the mouse button to use.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the button isnull
.IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.LocationUnavailableException
- if the given path cannot be found.- Since:
- 1.2
-
clickPath
Clicks the given path, expanding parent nodes if necessary.- Parameters:
path
- the given path.mouseClickInfo
- specifies the mouse button to use and how many times to click.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the givenMouseClickInfo
isnull
.IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.LocationUnavailableException
- if the given path cannot be found.- Since:
- 1.2
-
doubleClickRow
Double-clicks the given row.- Parameters:
row
- the given row.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if theJTree
is disabled.IllegalStateException
- if theJTree
is not showing on the screen.IndexOutOfBoundsException
- if the given row is less than zero or equal than or greater than the number of visible rows in theJTree
.LocationUnavailableException
- if a tree path for the given row cannot be found.- Since:
- 1.2
-
doubleClickPath
Double-clicks the given path.- Parameters:
path
- the given path.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if theJTree
is disabled.IllegalStateException
- if theJTree
is not showing on the screen.LocationUnavailableException
- if the given path cannot be found.- Since:
- 1.2
-
rightClickRow
Right-clicks the given row.- Parameters:
row
- the given row.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if theJTree
is disabled.IllegalStateException
- if theJTree
is not showing on the screen.IndexOutOfBoundsException
- if the given row is less than zero or equal than or greater than the number of visible rows in theJTree
.LocationUnavailableException
- if a tree path for the given row cannot be found.- Since:
- 1.2
-
rightClickPath
Right-clicks the given path, expanding parent nodes if necessary.- Parameters:
path
- the given path.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.LocationUnavailableException
- if the given path cannot be found.- Since:
- 1.2
-
click
Simulates a user clicking this fixture's
.JTree
- Specified by:
click
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.
-
click
Simulates a user clicking this fixture's
.JTree
- Specified by:
click
in interfaceMouseInputSimulationFixture
- Parameters:
button
- the button to click.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the givenMouseButton
isnull
.IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.
-
click
Simulates a user clicking this fixture's
.JTree
- 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'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.
-
doubleClick
Simulates a user double-clicking this fixture's
.JTree
- Specified by:
doubleClick
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.
-
rightClick
Simulates a user right-clicking this fixture's
.JTree
- Specified by:
rightClick
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.
-
drag
Simulates a user dragging a row from this fixture's
.JTree
- Parameters:
row
- the index of the row to drag.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.IndexOutOfBoundsException
- if the given row is less than zero or equal than or greater than the number of visible rows in theJTree
.LocationUnavailableException
- if a tree path for the given row cannot be found.
-
drag
Simulates a user dragging an item from this fixture's
.JTree
- Parameters:
path
- the path corresponding to the item to drag.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.LocationUnavailableException
- if the given path cannot be found.
-
drop
Simulates a user dropping an item into this fixture's
.JTree
- Parameters:
row
- the row to drop the item to.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.IndexOutOfBoundsException
- if the given row is less than zero or equal than or greater than the number of visible rows in theJTree
.LocationUnavailableException
- if a tree path for the given row cannot be found.ActionFailedException
- if there is no drag action in effect.
-
drop
Simulates a user dropping an item into this fixture's
.JTree
- Parameters:
path
- the path corresponding to the item relative to the drop point.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.LocationUnavailableException
- if the given path cannot be found.ActionFailedException
- if there is no drag action in effect.
-
selectPath
Selects the given path, expanding parent nodes if necessary. Unlike
, this method will not click the path if it is already selected.clickPath(String)
- Parameters:
path
- the path to select.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.LocationUnavailableException
- if the given path cannot be found.
-
selectPaths
Select the given paths, expanding parent nodes if necessary.- Parameters:
paths
- the paths to select.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the array of rows isnull
.IllegalArgumentException
- if the array of rows is empty.IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.LocationUnavailableException
- if the any of the given paths cannot be found.
-
selectRow
Simulates a user selecting the tree node at the given row.- Parameters:
row
- the index of the row to select.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.IndexOutOfBoundsException
- if the given row is less than zero or equal than or greater than the number of visible rows in theJTree
.LocationUnavailableException
- if a tree path for the given row cannot be found.
-
selectRows
Simulates a user selecting the tree nodes at the given rows.- Parameters:
rows
- the indices of the rows to select.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the array of rows isnull
.IllegalArgumentException
- if the array of rows is empty.IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.IndexOutOfBoundsException
- if the given row is less than zero or equal than or greater than the number of visible rows in theJTree
.LocationUnavailableException
- if a tree path for any of the given rows cannot be found.
-
toggleRow
Simulates a user toggling the open/closed state of the tree node at the given row.- Parameters:
row
- the index of the row to toggle.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.IndexOutOfBoundsException
- if the given row is less than zero or equal than or greater than the number of visible rows in theJTree
.LocationUnavailableException
- if a tree path for the given row cannot be found.ActionFailedException
- if this method fails to toggle the row.
-
expandRow
Simulates a user expanding the tree node at the given row.- Parameters:
row
- the index of the row to expand.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.IndexOutOfBoundsException
- if the given row is less than zero or equal than or greater than the number of visible rows in theJTree
.LocationUnavailableException
- if a tree path for the given row cannot be found.ActionFailedException
- if this method fails to expand the row.- Since:
- 1.2
-
collapseRow
Simulates a user collapsing the tree node at the given row.- Parameters:
row
- the index of the row to collapse.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.IndexOutOfBoundsException
- if the given row is less than zero or equal than or greater than the number of visible rows in theJTree
.LocationUnavailableException
- if a tree path for the given row cannot be found.ActionFailedException
- if this method fails to collapse the row.- Since:
- 1.2
-
expandPath
Simulates a user expanding the tree node at the given path.- Parameters:
path
- the path of the row to expand.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.LocationUnavailableException
- if the given path cannot be found.ActionFailedException
- if this method fails to expand the path.- Since:
- 1.2
-
collapsePath
Simulates a user collapsing the tree node at the given path.- Parameters:
path
- the path of the row to collapse.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.LocationUnavailableException
- if the given path cannot be found.ActionFailedException
- if this method fails to collapse the path.- Since:
- 1.2
-
showPopupMenuAt
Shows a pop-up menu at the position of the node in the given row.- Parameters:
row
- the index of the row invoking the pop-up menu.- Returns:
- a fixture that manages the displayed pop-up menu.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.IndexOutOfBoundsException
- if the given row is less than zero or equal than or greater than the number of visible rows in theJTree
.ComponentLookupException
- if a pop-up menu cannot be found.LocationUnavailableException
- if a tree path for the given row cannot be found.
-
showPopupMenuAt
Shows a pop-up menu at the position of the last node in the given path. The last node in the given path will be made visible (by expanding the parent node(s)) if it is not visible.- Parameters:
path
- the path of the node invoking the pop-up menu.- Returns:
- a fixture that manages the displayed pop-up menu.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.ComponentLookupException
- if a pop-up menu cannot be found.LocationUnavailableException
- if the given path cannot be found.
-
focus
Gives input focus to this fixture's
.JTree
- Specified by:
focus
in interfaceFocusableComponentFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
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 availableJTree
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'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.- See Also:
-
pressAndReleaseKeys
Simulates a user pressing and releasing the given keys in this fixture's
.JTree
- Specified by:
pressAndReleaseKeys
in interfaceKeyboardInputSimulationFixture
- Parameters:
keyCodes
- the 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'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.- See Also:
-
pressKey
Simulates a user pressing the given key on this fixture's
.JTree
- 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'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.- See Also:
-
releaseKey
Simulates a user releasing the given key on this fixture's
.JTree
- Specified by:
releaseKey
in interfaceKeyboardInputSimulationFixture
- Parameters:
keyCode
- the code of the key to release.- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.IllegalArgumentException
- if any of the given code is not a valid key code.- See Also:
-
requireFocused
Asserts that this fixture's
has input focus.JTree
- Specified by:
requireFocused
in interfaceFocusableComponentFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJTree
does not have input focus.
-
requireEnabled
Asserts that this fixture's
is enabled.JTree
- Specified by:
requireEnabled
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJTree
is disabled.
-
requireEnabled
Asserts that this fixture's
is enabled.JTree
- 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'sJTree
is never enabled.
-
requireDisabled
Asserts that this fixture's
is disabled.JTree
- Specified by:
requireDisabled
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJTree
is enabled.
-
requireVisible
Asserts that this fixture's
is visible.JTree
- Specified by:
requireVisible
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJTree
is not visible.
-
requireNotVisible
Asserts that this fixture's
is not visible.JTree
- Specified by:
requireNotVisible
in interfaceStateVerificationFixture
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJTree
is visible.
-
requireEditable
Asserts that this fixture's
is editable.JTree
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJTree
is not editable.AssertionError
- if this fixture'sJTree
is not editable.
-
requireNotEditable
Asserts that this fixture's
is not editable.JTree
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJTree
is editable.AssertionError
- if this fixture'sJTree
is editable.
-
requireSelection
Asserts that this fixture's
selection is equal to the given paths.JTree
- Parameters:
paths
- the given paths, expected to be selected.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the array of paths isnull
.LocationUnavailableException
- if any of the given path cannot be found.AssertionError
- if this fixture'sJTree
selection is not equal to the given paths.
-
requireSelection
Asserts that this fixture's
's selected rows are equal to the given one.JTree
- Parameters:
rows
- the indices of the rows, expected to be selected.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the array of row indices isnull
.AssertionError
- if this fixture'sJTree
selection is not equal to the given rows.
-
requireNoSelection
Asserts that this fixture's
's does not have any selection.JTree
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sJTree
has a selection.
-
requireToolTip
Asserts that the toolTip in this fixture's
matches the given value.JTree
- 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'sJTree
does not match the given value.- Since:
- 1.2
-
requireToolTip
Asserts that the toolTip in this fixture's
matches the given regular expression pattern.JTree
- 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'sJTree
does not match the given regular expression.- Since:
- 1.2
-
clientProperty
Returns the client property stored in this fixture's
, under the given key.JButton
- 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.JTree
- Specified by:
showPopupMenu
in interfaceJPopupMenuInvokerFixture
- Returns:
- a fixture that manages the displayed pop-up menu.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
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.JTree
- 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'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.ComponentLookupException
- if a pop-up menu cannot be found.
-
separator
Returns the separator to use when converting
s toTreePath
String
s.- Returns:
- the separator to use when converting
s toTreePath
String
s.
-
separator
Updates the separator to use when converting
s toTreePath
String
s. The default value is "/".- Parameters:
separator
- the new separator.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the given separator isnull
.
-
cellReader
Updates the implementation of
to use when comparing internal values of aJTreeCellReader
and the values expected in a test. The default implementation to use isJTree
.BasicJTreeCellReader
- Parameters:
cellReader
- the newJTreeCellValueReader
to use.- Returns:
- this fixture.
- Throws:
NullPointerException
- ifcellReader
isnull
.
-
node
Returns a fixture that manages the node specified by the given row.- Parameters:
row
- the given row.- Returns:
- a fixture that manages the node specified by the given row.
- Throws:
IndexOutOfBoundsException
- if the given index is less than zero or equal than or greater than the number of visible rows in theJTree
.- Since:
- 1.2
-
node
Returns a fixture that manages the node specified by the given path.- Parameters:
path
- the given path.- Returns:
- a fixture that manages the node specified by the given path.
- Throws:
LocationUnavailableException
- if the given path cannot be found.- Since:
- 1.2
-
valueAt
Returns theString
representation of the node at the given path.- Parameters:
path
- the given path.- Returns:
- the
String
representation of the node at the given path. - Throws:
LocationUnavailableException
- if the given path cannot be found.- Since:
- 1.2
-
valueAt
Returns theString
representation of the given row.- Parameters:
row
- the given row.- Returns:
- the
String
representation of the node at the given path. - Throws:
IndexOutOfBoundsException
- if the given row is less than zero or equal than or greater than the number of visible rows in theJTree
.LocationUnavailableException
- if a tree path for the given row cannot be found.- Since:
- 1.2
-