org.fest.swing.fixture
Class JTreeFixture

java.lang.Object
  extended by org.fest.swing.fixture.ComponentFixture<JTree>
      extended by org.fest.swing.fixture.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 JTrees:

TreePaths can be specified using Strings. 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 JTree renderer is performed by a JTreeCellReader. This fixture uses a BasicJTreeCellReader by default.

Author:
Keith Coughtrey, Alex Ruiz, Yvonne Wang, Fabien Barbero

Field Summary
 
Fields inherited from class org.fest.swing.fixture.ComponentFixture
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target
 
Constructor Summary
JTreeFixture(Robot robot, JTree target)
          Creates a new JTreeFixture.
JTreeFixture(Robot robot, String treeName)
          Creates a new JTreeFixture.
 
Method Summary
 JTreeFixture cellReader(JTreeCellReader cellReader)
          Updates the implementation of JTreeCellReader to use when comparing internal values of a JTree and the values expected in a test.
 JTreeFixture click()
          Simulates a user clicking this fixture's JTree.
 JTreeFixture click(MouseButton button)
          Simulates a user clicking this fixture's JTree.
 JTreeFixture click(MouseClickInfo mouseClickInfo)
          Simulates a user clicking this fixture's JTree.
 JTreeFixture clickPath(String path)
          Clicks the given path, expanding parent nodes if necessary.
 JTreeFixture clickPath(String path, MouseButton button)
          Clicks the given path, expanding parent nodes if necessary.
 JTreeFixture clickPath(String path, MouseClickInfo mouseClickInfo)
          Clicks the given path, expanding parent nodes if necessary.
 JTreeFixture clickRow(int row)
          Clicks the given row.
 JTreeFixture clickRow(int row, MouseButton button)
          Clicks the given row.
 JTreeFixture clickRow(int row, MouseClickInfo mouseClickInfo)
          Clicks the given row.
 Object clientProperty(Object key)
          Returns the client property stored in this fixture's JButton, under the given key.
 JTreeFixture collapsePath(String path)
          Simulates a user collapsing the tree node at the given path.
 JTreeFixture collapseRow(int row)
          Simulates a user collapsing the tree node at the given row.
 JTreeFixture doubleClick()
          Simulates a user double-clicking this fixture's JTree.
 JTreeFixture doubleClickPath(String path)
          Double-clicks the given path.
 JTreeFixture doubleClickRow(int row)
          Double-clicks the given row.
 JTreeFixture drag(int row)
          Simulates a user dragging a row from this fixture's JTree.
 JTreeFixture drag(String path)
          Simulates a user dragging an item from this fixture's JTree.
protected  void driver(JTreeDriver newDriver)
          Sets the JTreeDriver to be used by this fixture.
 JTreeFixture drop(int row)
          Simulates a user dropping an item into this fixture's JTree.
 JTreeFixture drop(String path)
          Simulates a user dropping an item into this fixture's JTree.
 JTreeFixture expandPath(String path)
          Simulates a user expanding the tree node at the given path.
 JTreeFixture expandRow(int row)
          Simulates a user expanding the tree node at the given row.
 JTreeFixture focus()
          Gives input focus to this fixture's JTree.
 JTreeNodeFixture node(int row)
          Returns a fixture that manages the node specified by the given row.
 JTreeNodeFixture node(String path)
          Returns a fixture that manages the node specified by the given path.
 JTreeFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
          Simulates a user pressing given key with the given modifiers on this fixture's JTree.
 JTreeFixture pressAndReleaseKeys(int... keyCodes)
          Simulates a user pressing and releasing the given keys in this fixture's JTree.
 JTreeFixture pressKey(int keyCode)
          Simulates a user pressing the given key on this fixture's JTree.
 JTreeFixture releaseKey(int keyCode)
          Simulates a user releasing the given key on this fixture's JTree.
 JTreeFixture requireDisabled()
          Asserts that this fixture's JTree is disabled.
 JTreeFixture requireEditable()
          Asserts that this fixture's JTree is editable.
 JTreeFixture requireEnabled()
          Asserts that this fixture's JTree is enabled.
 JTreeFixture requireEnabled(Timeout timeout)
          Asserts that this fixture's JTree is enabled.
 JTreeFixture requireFocused()
          Asserts that this fixture's JTree has input focus.
 JTreeFixture requireNoSelection()
          Asserts that this fixture's JTree's does not have any selection.
 JTreeFixture requireNotEditable()
          Asserts that this fixture's JTree is not editable.
 JTreeFixture requireNotVisible()
          Asserts that this fixture's JTree is not visible.
 JTreeFixture requireSelection(int... rows)
          Asserts that this fixture's JTree's selected rows are equal to the given one.
 JTreeFixture requireSelection(String... paths)
          Asserts that this fixture's JTree selection is equal to the given paths.
 JTreeFixture requireToolTip(Pattern pattern)
          Asserts that the toolTip in this fixture's JTree matches the given regular expression pattern.
 JTreeFixture requireToolTip(String expected)
          Asserts that the toolTip in this fixture's JTree matches the given value.
 JTreeFixture requireVisible()
          Asserts that this fixture's JTree is visible.
 JTreeFixture rightClick()
          Simulates a user right-clicking this fixture's JTree.
 JTreeFixture rightClickPath(String path)
          Right-clicks the given path, expanding parent nodes if necessary.
 JTreeFixture rightClickRow(int row)
          Right-clicks the given row.
 JTreeFixture selectPath(String path)
          Selects the given path, expanding parent nodes if necessary.
 JTreeFixture selectPaths(String... paths)
          Select the given paths, expanding parent nodes if necessary.
 JTreeFixture selectRow(int row)
          Simulates a user selecting the tree node at the given row.
 JTreeFixture selectRows(int... rows)
          Simulates a user selecting the tree nodes at the given rows.
 String separator()
          Returns the separator to use when converting TreePaths to Strings.
 JTreeFixture separator(String separator)
          Updates the separator to use when converting TreePaths to Strings.
 JPopupMenuFixture showPopupMenu()
          Shows a pop-up menu using this fixture's JTree as the invoker of the pop-up menu.
 JPopupMenuFixture showPopupMenuAt(int row)
          Shows a pop-up menu at the position of the node in the given row.
 JPopupMenuFixture showPopupMenuAt(Point p)
          Shows a pop-up menu at the given point using this fixture's JTree as the invoker of the pop-up menu.
 JPopupMenuFixture showPopupMenuAt(String path)
          Shows a pop-up menu at the position of the last node in the given path.
 JTreeFixture toggleRow(int row)
          Simulates a user toggling the open/closed state of the tree node at the given row.
 String valueAt(int row)
          Returns the String representation of the given row.
 String valueAt(String path)
          Returns the String representation of the node at the given path.
 
Methods inherited from class org.fest.swing.fixture.ComponentFixture
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JTreeFixture

public JTreeFixture(Robot robot,
                    JTree target)
Creates a new JTreeFixture.

Parameters:
robot - performs simulation of user events on the given JTree.
target - the JTree to be managed by this fixture.
Throws:
NullPointerException - if robot is null.
NullPointerException - if target is null.

JTreeFixture

public JTreeFixture(Robot robot,
                    String treeName)
Creates a new JTreeFixture.

Parameters:
robot - performs simulation of user events on a JTree.
treeName - the name of the JTree to find using the given Robot.
Throws:
NullPointerException - if robot is null.
ComponentLookupException - if a matching JTree could not be found.
ComponentLookupException - if more than one matching JTree is found.
Method Detail

driver

protected final void driver(JTreeDriver newDriver)
Sets the JTreeDriver to be used by this fixture.

Parameters:
newDriver - the new JTreeDriver.
Throws:
NullPointerException - if the given driver is null.

clickRow

public JTreeFixture clickRow(int row)
Clicks the given row.

Parameters:
row - the given row.
Returns:
this fixture.
Throws:
IllegalStateException - if the JTree is disabled.
IllegalStateException - if the JTree 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 the JTree.
LocationUnavailableException - if a tree path for the given row cannot be found.
Since:
1.2

clickRow

public JTreeFixture clickRow(int row,
                             MouseButton button)
Clicks the given row.

Parameters:
row - the given row.
button - the mouse button to use.
Returns:
this fixture.
Throws:
NullPointerException - if the button is null.
IllegalStateException - if the JTree is disabled.
IllegalStateException - if the JTree 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 the JTree.
LocationUnavailableException - if a tree path for the given row cannot be found.
Since:
1.2

clickRow

public JTreeFixture clickRow(int row,
                             MouseClickInfo mouseClickInfo)
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 given MouseClickInfo is null.
IllegalStateException - if the JTree is disabled.
IllegalStateException - if the JTree 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 the JTree.
LocationUnavailableException - if a tree path for the given row cannot be found.
Since:
1.2

clickPath

public JTreeFixture clickPath(String path)
Clicks the given path, expanding parent nodes if necessary.

Parameters:
path - the given path.
Returns:
this fixture.
Throws:
IllegalStateException - if this fixture's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.
LocationUnavailableException - if the given path cannot be found.

clickPath

public JTreeFixture clickPath(String path,
                              MouseButton button)
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 is null.
IllegalStateException - if this fixture's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.
LocationUnavailableException - if the given path cannot be found.
Since:
1.2

clickPath

public JTreeFixture clickPath(String path,
                              MouseClickInfo mouseClickInfo)
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 given MouseClickInfo is null.
IllegalStateException - if this fixture's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.
LocationUnavailableException - if the given path cannot be found.
Since:
1.2

doubleClickRow

public JTreeFixture doubleClickRow(int row)
Double-clicks the given row.

Parameters:
row - the given row.
Returns:
this fixture.
Throws:
IllegalStateException - if the JTree is disabled.
IllegalStateException - if the JTree 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 the JTree.
LocationUnavailableException - if a tree path for the given row cannot be found.
Since:
1.2

doubleClickPath

public JTreeFixture doubleClickPath(String path)
Double-clicks the given path.

Parameters:
path - the given path.
Returns:
this fixture.
Throws:
IllegalStateException - if the JTree is disabled.
IllegalStateException - if the JTree is not showing on the screen.
LocationUnavailableException - if the given path cannot be found.
Since:
1.2

rightClickRow

public JTreeFixture rightClickRow(int row)
Right-clicks the given row.

Parameters:
row - the given row.
Returns:
this fixture.
Throws:
IllegalStateException - if the JTree is disabled.
IllegalStateException - if the JTree 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 the JTree.
LocationUnavailableException - if a tree path for the given row cannot be found.
Since:
1.2

rightClickPath

public JTreeFixture rightClickPath(String path)
Right-clicks the given path, expanding parent nodes if necessary.

Parameters:
path - the given path.
Returns:
this fixture.
Throws:
IllegalStateException - if this fixture's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.
LocationUnavailableException - if the given path cannot be found.
Since:
1.2

click

public JTreeFixture click()
Simulates a user clicking this fixture's JTree.

Specified by:
click in interface MouseInputSimulationFixture
Returns:
this fixture.
Throws:
IllegalStateException - if this fixture's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.

click

public JTreeFixture click(MouseButton button)
Simulates a user clicking this fixture's JTree.

Specified by:
click in interface MouseInputSimulationFixture
Parameters:
button - the button to click.
Returns:
this fixture.
Throws:
NullPointerException - if the given MouseButton is null.
IllegalStateException - if this fixture's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.

click

public JTreeFixture click(MouseClickInfo mouseClickInfo)
Simulates a user clicking this fixture's JTree.

Specified by:
click in interface MouseInputSimulationFixture
Parameters:
mouseClickInfo - specifies the button to click and the times the button should be clicked.
Returns:
this fixture.
Throws:
NullPointerException - if the given MouseClickInfo is null.
IllegalStateException - if this fixture's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.

doubleClick

public JTreeFixture doubleClick()
Simulates a user double-clicking this fixture's JTree.

Specified by:
doubleClick in interface MouseInputSimulationFixture
Returns:
this fixture.
Throws:
IllegalStateException - if this fixture's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.

rightClick

public JTreeFixture rightClick()
Simulates a user right-clicking this fixture's JTree.

Specified by:
rightClick in interface MouseInputSimulationFixture
Returns:
this fixture.
Throws:
IllegalStateException - if this fixture's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.

drag

public JTreeFixture drag(int row)
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's JTree is disabled.
IllegalStateException - if this fixture's JTree 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 the JTree.
LocationUnavailableException - if a tree path for the given row cannot be found.

drag

public JTreeFixture drag(String path)
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's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.
LocationUnavailableException - if the given path cannot be found.

drop

public JTreeFixture drop(int row)
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's JTree is disabled.
IllegalStateException - if this fixture's JTree 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 the JTree.
LocationUnavailableException - if a tree path for the given row cannot be found.
ActionFailedException - if there is no drag action in effect.

drop

public JTreeFixture drop(String path)
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's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.
LocationUnavailableException - if the given path cannot be found.
ActionFailedException - if there is no drag action in effect.

selectPath

public JTreeFixture selectPath(String path)
Selects the given path, expanding parent nodes if necessary. Unlike clickPath(String), this method will not click the path if it is already selected.

Parameters:
path - the path to select.
Returns:
this fixture.
Throws:
IllegalStateException - if this fixture's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.
LocationUnavailableException - if the given path cannot be found.

selectPaths

public JTreeFixture selectPaths(String... paths)
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 is null.
IllegalArgumentException - if the array of rows is empty.
IllegalStateException - if this fixture's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.
LocationUnavailableException - if the any of the given paths cannot be found.

selectRow

public JTreeFixture selectRow(int row)
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's JTree is disabled.
IllegalStateException - if this fixture's JTree 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 the JTree.
LocationUnavailableException - if a tree path for the given row cannot be found.

selectRows

public JTreeFixture selectRows(int... rows)
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 is null.
IllegalArgumentException - if the array of rows is empty.
IllegalStateException - if this fixture's JTree is disabled.
IllegalStateException - if this fixture's JTree 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 the JTree.
LocationUnavailableException - if a tree path for any of the given rows cannot be found.

toggleRow

public JTreeFixture toggleRow(int row)
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's JTree is disabled.
IllegalStateException - if this fixture's JTree 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 the JTree.
LocationUnavailableException - if a tree path for the given row cannot be found.
ActionFailedException - if this method fails to toggle the row.

expandRow

public JTreeFixture expandRow(int row)
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's JTree is disabled.
IllegalStateException - if this fixture's JTree 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 the JTree.
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

public JTreeFixture collapseRow(int row)
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's JTree is disabled.
IllegalStateException - if this fixture's JTree 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 the JTree.
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

public JTreeFixture expandPath(String path)
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's JTree is disabled.
IllegalStateException - if this fixture's JTree 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

public JTreeFixture collapsePath(String path)
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's JTree is disabled.
IllegalStateException - if this fixture's JTree 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

public JPopupMenuFixture showPopupMenuAt(int row)
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's JTree is disabled.
IllegalStateException - if this fixture's JTree 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 the JTree.
ComponentLookupException - if a pop-up menu cannot be found.
LocationUnavailableException - if a tree path for the given row cannot be found.

showPopupMenuAt

public JPopupMenuFixture showPopupMenuAt(String path)
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's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.
ComponentLookupException - if a pop-up menu cannot be found.
LocationUnavailableException - if the given path cannot be found.

focus

public JTreeFixture focus()
Gives input focus to this fixture's JTree.

Specified by:
focus in interface FocusableComponentFixture
Returns:
this fixture.
Throws:
IllegalStateException - if this fixture's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.

pressAndReleaseKey

public JTreeFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
Simulates a user pressing given key with the given modifiers on this fixture's JTree. Modifiers is a mask from the available InputEvent masks.

Specified by:
pressAndReleaseKey in interface KeyboardInputSimulationFixture
Parameters:
keyPressInfo - specifies the key and modifiers to press.
Returns:
this fixture.
Throws:
NullPointerException - if the given KeyPressInfo is null.
IllegalArgumentException - if the given code is not a valid key code.
IllegalStateException - if this fixture's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.
See Also:
KeyPressInfo

pressAndReleaseKeys

public JTreeFixture pressAndReleaseKeys(int... keyCodes)
Simulates a user pressing and releasing the given keys in this fixture's JTree.

Specified by:
pressAndReleaseKeys in interface KeyboardInputSimulationFixture
Parameters:
keyCodes - the codes of the keys to press.
Returns:
this fixture.
Throws:
NullPointerException - if the given array of codes is null.
IllegalArgumentException - if any of the given code is not a valid key code.
IllegalStateException - if this fixture's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.
See Also:
KeyEvent

pressKey

public JTreeFixture pressKey(int keyCode)
Simulates a user pressing the given key on this fixture's JTree.

Specified by:
pressKey in interface KeyboardInputSimulationFixture
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's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.
See Also:
KeyEvent

releaseKey

public JTreeFixture releaseKey(int keyCode)
Simulates a user releasing the given key on this fixture's JTree.

Specified by:
releaseKey in interface KeyboardInputSimulationFixture
Parameters:
keyCode - the code of the key to release.
Returns:
this fixture.
Throws:
IllegalStateException - if this fixture's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.
IllegalArgumentException - if any of the given code is not a valid key code.
See Also:
KeyEvent

requireFocused

public JTreeFixture requireFocused()
Asserts that this fixture's JTree has input focus.

Specified by:
requireFocused in interface FocusableComponentFixture
Returns:
this fixture.
Throws:
AssertionError - if this fixture's JTree does not have input focus.

requireEnabled

public JTreeFixture requireEnabled()
Asserts that this fixture's JTree is enabled.

Specified by:
requireEnabled in interface StateVerificationFixture
Returns:
this fixture.
Throws:
AssertionError - if this fixture's JTree is disabled.

requireEnabled

public JTreeFixture requireEnabled(Timeout timeout)
Asserts that this fixture's JTree is enabled.

Specified by:
requireEnabled in interface StateVerificationFixture
Parameters:
timeout - the time this fixture will wait for the component to be enabled.
Returns:
this fixture.
Throws:
WaitTimedOutError - if this fixture's JTree is never enabled.

requireDisabled

public JTreeFixture requireDisabled()
Asserts that this fixture's JTree is disabled.

Specified by:
requireDisabled in interface StateVerificationFixture
Returns:
this fixture.
Throws:
AssertionError - if this fixture's JTree is enabled.

requireVisible

public JTreeFixture requireVisible()
Asserts that this fixture's JTree is visible.

Specified by:
requireVisible in interface StateVerificationFixture
Returns:
this fixture.
Throws:
AssertionError - if this fixture's JTree is not visible.

requireNotVisible

public JTreeFixture requireNotVisible()
Asserts that this fixture's JTree is not visible.

Specified by:
requireNotVisible in interface StateVerificationFixture
Returns:
this fixture.
Throws:
AssertionError - if this fixture's JTree is visible.

requireEditable

public JTreeFixture requireEditable()
Asserts that this fixture's JTree is editable.

Returns:
this fixture.
Throws:
AssertionError - if this fixture's JTree is not editable.
AssertionError - if this fixture's JTree is not editable.

requireNotEditable

public JTreeFixture requireNotEditable()
Asserts that this fixture's JTree is not editable.

Returns:
this fixture.
Throws:
AssertionError - if this fixture's JTree is editable.
AssertionError - if this fixture's JTree is editable.

requireSelection

public JTreeFixture requireSelection(String... paths)
Asserts that this fixture's JTree selection is equal to the given paths.

Parameters:
paths - the given paths, expected to be selected.
Returns:
this fixture.
Throws:
NullPointerException - if the array of paths is null.
LocationUnavailableException - if any of the given path cannot be found.
AssertionError - if this fixture's JTree selection is not equal to the given paths.

requireSelection

public JTreeFixture requireSelection(int... rows)
Asserts that this fixture's JTree's selected rows are equal to the given one.

Parameters:
rows - the indices of the rows, expected to be selected.
Returns:
this fixture.
Throws:
NullPointerException - if the array of row indices is null.
AssertionError - if this fixture's JTree selection is not equal to the given rows.

requireNoSelection

public JTreeFixture requireNoSelection()
Asserts that this fixture's JTree's does not have any selection.

Returns:
this fixture.
Throws:
AssertionError - if this fixture's JTree has a selection.

requireToolTip

public JTreeFixture requireToolTip(String expected)
Asserts that the toolTip in this fixture's JTree matches the given value.

Specified by:
requireToolTip in interface ToolTipDisplayFixture
Parameters:
expected - the given value. It can be a regular expression.
Returns:
this fixture.
Throws:
AssertionError - if the toolTip in this fixture's JTree does not match the given value.
Since:
1.2

requireToolTip

public JTreeFixture requireToolTip(Pattern pattern)
Asserts that the toolTip in this fixture's JTree matches the given regular expression pattern.

Specified by:
requireToolTip in interface ToolTipDisplayFixture
Parameters:
pattern - the regular expression pattern to match.
Returns:
this fixture.
Throws:
NullPointerException - if the given regular expression pattern is null.
AssertionError - if the toolTip in this fixture's JTree does not match the given regular expression.
Since:
1.2

clientProperty

public Object clientProperty(Object key)
Returns the client property stored in this fixture's JButton, under the given key.

Specified by:
clientProperty in interface ClientPropertyStorageFixture
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 is null.
Since:
1.2

showPopupMenu

public JPopupMenuFixture showPopupMenu()
Shows a pop-up menu using this fixture's JTree as the invoker of the pop-up menu.

Specified by:
showPopupMenu in interface JPopupMenuInvokerFixture
Returns:
a fixture that manages the displayed pop-up menu.
Throws:
IllegalStateException - if this fixture's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.
ComponentLookupException - if a pop-up menu cannot be found.

showPopupMenuAt

public JPopupMenuFixture showPopupMenuAt(Point p)
Shows a pop-up menu at the given point using this fixture's JTree as the invoker of the pop-up menu.

Specified by:
showPopupMenuAt in interface JPopupMenuInvokerFixture
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's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.
ComponentLookupException - if a pop-up menu cannot be found.

separator

public String separator()
Returns the separator to use when converting TreePaths to Strings.

Returns:
the separator to use when converting TreePaths to Strings.

separator

public JTreeFixture separator(String separator)
Updates the separator to use when converting TreePaths to Strings. The default value is "/".

Parameters:
separator - the new separator.
Returns:
this fixture.
Throws:
NullPointerException - if the given separator is null.

cellReader

public JTreeFixture cellReader(JTreeCellReader cellReader)
Updates the implementation of JTreeCellReader to use when comparing internal values of a JTree and the values expected in a test. The default implementation to use is BasicJTreeCellReader.

Parameters:
cellReader - the new JTreeCellValueReader to use.
Returns:
this fixture.
Throws:
NullPointerException - if cellReader is null.

node

public JTreeNodeFixture node(int row)
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 the JTree.
Since:
1.2

node

public JTreeNodeFixture node(String path)
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

public String valueAt(String path)
Returns the String 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

public String valueAt(int row)
Returns the String 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 the JTree.
LocationUnavailableException - if a tree path for the given row cannot be found.
Since:
1.2


Copyright © 2007-2011 FEST (Fixtures for Easy Software Testing). All Rights Reserved.