org.fest.swing.fixture
Class JTableFixture

java.lang.Object
  extended by org.fest.swing.fixture.ComponentFixture<JTable>
      extended by org.fest.swing.fixture.JTableFixture
All Implemented Interfaces:
ClientPropertyStorageFixture, CommonComponentFixture, FocusableComponentFixture, JComponentFixture, JPopupMenuInvokerFixture, KeyboardInputSimulationFixture, MouseInputSimulationFixture, StateVerificationFixture, ToolTipDisplayFixture

public class JTableFixture
extends ComponentFixture<JTable>
implements CommonComponentFixture, JComponentFixture, JPopupMenuInvokerFixture

Understands functional testing of JTables:

The conversion between the values given in tests and the values being displayed by a JTable renderer is performed by a JTableCellReader. This fixture uses a BasicJTableCellReader by default.

Author:
Alex Ruiz, Yvonne Wang, Fabien Barbero, Andriy Tsykholyas

Field Summary
 
Fields inherited from class org.fest.swing.fixture.ComponentFixture
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target
 
Constructor Summary
JTableFixture(Robot robot, JTable target)
          Creates a new JTableFixture.
JTableFixture(Robot robot, String tableName)
          Creates a new JTableFixture.
 
Method Summary
 ColorFixture backgroundAt(TableCell cell)
          Returns a fixture that verifies the background color of the given table cell.
 TableCell cell(Pattern valuePattern)
          Returns a fixture that manages the table cell whose value matches the given regular expression pattern.
 TableCell cell(String value)
          Returns a fixture that manages the table cell whose value matches the given one.
 JTableCellFixture cell(TableCell cell)
          Returns a fixture that manages the table cell specified by the given row and column.
 JTableCellFixture cell(TableCellFinder cellFinder)
          Returns a fixture that manages the table cell found by the given TableCellFinder.
 JTableFixture cellReader(JTableCellReader cellReader)
          Updates the implementation of JTableCellReader to use when comparing internal values of this fixture's JTable and the values expected in a test.
 JTableFixture cellWriter(JTableCellWriter cellWriter)
          Updates the implementation of JTableCellWriter to use when comparing internal values of this fixture's JTable and the values expected in a test.
 JTableFixture click()
          Simulates a user clicking this fixture's JTable.
 JTableFixture click(MouseButton button)
          Simulates a user clicking this fixture's JTable.
 JTableFixture click(MouseClickInfo mouseClickInfo)
          Simulates a user clicking this fixture's JTable.
 JTableFixture click(TableCell cell, MouseButton button)
          Simulates a user clicking a cell in this fixture's JTable once, using the specified mouse button.
 JTableFixture click(TableCell cell, MouseClickInfo mouseClickInfo)
          Simulates a user clicking a cell in this fixture's JTable, using the specified mouse button the given number of times.
 Object clientProperty(Object key)
          Returns the client property stored in this fixture's JTable, under the given key.
 int columnIndexFor(Object columnName)
          Returns the index of the column in this fixture's JTable whose name matches the given one.
 String[][] contents()
          Returns the String representation of the cells in the in this fixture's JTable, using this fixture's JTableCellReader.
 JTableFixture doubleClick()
          Simulates a user double-clicking this fixture's JTable.
 JTableFixture drag(TableCell cell)
          Simulates a user dragging an item from this fixture's JTable.
protected  JTableDriver driver()
          Returns the JTableDriver used by this fixture.
protected  void driver(JTableDriver newDriver)
          Sets the JTableDriver to be used by this fixture.
 JTableFixture drop(TableCell cell)
          Simulates a user dropping an item to this fixture's JTable.
 JTableFixture enterValue(TableCell cell, String value)
          Enters the given value in the given cell of this fixture's JTable, using this fixture's JTableCellWriter.
 JTableFixture focus()
          Gives input focus to this fixture's JTable.
 FontFixture fontAt(TableCell cell)
          Returns a fixture that verifies the font of the given table cell.
 ColorFixture foregroundAt(TableCell cell)
          Returns a fixture that verifies the foreground color of the given table cell.
 Point pointAt(TableCell cell)
          Converts the given cell into a coordinate pair.
 JTableFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
          Simulates a user pressing given key with the given modifiers on this fixture's JTable.
 JTableFixture pressAndReleaseKeys(int... keyCodes)
          Simulates a user pressing and releasing the given keys on this fixture's JTable.
 JTableFixture pressKey(int keyCode)
          Simulates a user pressing the given key on this fixture's JTable.
 JTableFixture releaseKey(int keyCode)
          Simulates a user releasing the given key on this fixture's JTable.
 JTableFixture requireCellValue(TableCell cell, Pattern pattern)
          Asserts that the value of the given cell matches the given regular expression pattern.
 JTableFixture requireCellValue(TableCell cell, String value)
          Asserts that the value of the given cell matches the given value.
 JTableFixture requireColumnCount(int expected)
          Asserts that this fixture's JTable has the given number of columns.
 JTableFixture requireContents(String[][] contents)
          Asserts that the String representation of the cell values in this fixture's JTable is equal to the given String array.
 JTableFixture requireDisabled()
          Asserts that this fixture's JTable is disabled.
 JTableFixture requireEditable(TableCell cell)
          Asserts that the given cell in this fixture's JTable is editable.
 JTableFixture requireEnabled()
          Asserts that this fixture's JTable is enabled.
 JTableFixture requireEnabled(Timeout timeout)
          Asserts that this fixture's JTable is enabled.
 JTableFixture requireFocused()
          Asserts that this fixture's JTable has input focus.
 JTableFixture requireNoSelection()
          Verifies that this fixture's JTable does not have any selection.
 JTableFixture requireNotEditable(TableCell cell)
          Asserts that the given cell in this fixture's JTable is not editable.
 JTableFixture requireNotVisible()
          Asserts that this fixture's JTable is not visible.
 JTableFixture requireRowCount(int expected)
          Asserts that this fixture's JTable has the given number of rows.
 JTableFixture requireSelectedRows(int... rows)
          Asserts that the set of selected rows in this fixture's JTable contains to the given row indices.
 JTableFixture requireToolTip(Pattern pattern)
          Asserts that the toolTip in this fixture's JTable matches the given regular expression pattern.
 JTableFixture requireToolTip(String expected)
          Asserts that the toolTip in this fixture's JTable matches the given value.
 JTableFixture requireVisible()
          Asserts that this fixture's JTable is visible.
 JTableFixture rightClick()
          Simulates a user right-clicking this fixture's JTable.
 int rowCount()
          Returns the number of rows that can be shown in this fixture's JTable, given unlimited space.
 JTableFixture selectCell(TableCell cell)
          Simulates a user selecting the given cell (row and column) of this fixture's JTable.
 JTableFixture selectCells(TableCell... cells)
          Simulates a user selecting the given cells of this fixture's JTable.
 String selectionValue()
          Returns the String representation of the selected cell in this fixture's JTable, using this fixture's JTableCellReader.
 JTableFixture selectRows(int... rows)
          Simulates a user selecting the given rows in this fixture's JTable.
 JPopupMenuFixture showPopupMenu()
          Shows a pop-up menu using this fixture's JTable as the invoker of the pop-up menu.
 JPopupMenuFixture showPopupMenuAt(Point p)
          Shows a pop-up menu at the given point using this fixture's JTable as the invoker of the pop-up menu.
 JPopupMenuFixture showPopupMenuAt(TableCell cell)
          Shows a pop-up menu at the given cell.
 JTableHeaderFixture tableHeader()
          Returns a JTableHeaderFixture wrapping the JTableHeader in this fixture's JTable.
 String valueAt(TableCell cell)
          Returns the String representation of the value of a cell in this fixture's JTable, using this fixture's JTableCellReader.
 
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

JTableFixture

public JTableFixture(Robot robot,
                     JTable target)
Creates a new JTableFixture.

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

JTableFixture

public JTableFixture(Robot robot,
                     String tableName)
Creates a new JTableFixture.

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

driver

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

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

driver

protected final JTableDriver driver()
Returns the JTableDriver used by this fixture.

Returns:
the JTableDriver used by this fixture.

fontAt

public FontFixture fontAt(TableCell cell)
Returns a fixture that verifies the font of the given table cell.

Parameters:
cell - the given table cell.
Returns:
a fixture that verifies the font of the given table cell.
Throws:
NullPointerException - if the cell is null.
IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.

backgroundAt

public ColorFixture backgroundAt(TableCell cell)
Returns a fixture that verifies the background color of the given table cell.

Parameters:
cell - the given table cell.
Returns:
a fixture that verifies the background color of the given table cell.
Throws:
NullPointerException - if the cell is null.
IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.

foregroundAt

public ColorFixture foregroundAt(TableCell cell)
Returns a fixture that verifies the foreground color of the given table cell.

Parameters:
cell - the given table cell.
Returns:
a fixture that verifies the foreground color of the given table cell.
Throws:
NullPointerException - if the cell is null.
IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.

cell

public TableCell cell(String value)
Returns a fixture that manages the table cell whose value matches the given one.

Parameters:
value - the value of the cell to look for. It can be a regular expression.
Returns:
a fixture that manages the table cell whose value matches the given one.
Throws:
ActionFailedException - if a cell with a matching value cannot be found.

cell

public TableCell cell(Pattern valuePattern)
Returns a fixture that manages the table cell whose value matches the given regular expression pattern.

Parameters:
valuePattern - the regular expression pattern to match.
Returns:
a fixture that manages the table cell whose value matches the given one.
Throws:
NullPointerException - if the given regular expression pattern is null.
ActionFailedException - if a cell with a matching value cannot be found.
Since:
1.2

cell

public JTableCellFixture cell(TableCellFinder cellFinder)
Returns a fixture that manages the table cell found by the given TableCellFinder.

Parameters:
cellFinder - knows how to find a cell.
Returns:
a fixture that manages the found table cell.
Throws:
NullPointerException - if the TableCellFinder is null.
ActionFailedException - if a matching cell could not be found.
IndexOutOfBoundsException - if the row or column indices in the found cell are out of bounds.

cell

public JTableCellFixture cell(TableCell cell)
Returns a fixture that manages the table cell specified by the given row and column.

Parameters:
cell - the cell of interest.
Returns:
a fixture that manages the table cell specified by the given row and column.
Throws:
NullPointerException - if the cell is null.
IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.

tableHeader

public JTableHeaderFixture tableHeader()
Returns a JTableHeaderFixture wrapping the JTableHeader in this fixture's JTable.

Returns:
a JTableHeaderFixture wrapping the JTableHeader in this fixture's JTable.
Throws:
AssertionError - if the JTableHeader in this fixture's JTable is null.

selectionValue

public String selectionValue()
Returns the String representation of the selected cell in this fixture's JTable, using this fixture's JTableCellReader. Returns null if one can not be obtained or if the JTable does not have any selected cell.

Returns:
the String representation of the selected cell.
See Also:
cellReader(JTableCellReader)

pointAt

public Point pointAt(TableCell cell)
Converts the given cell into a coordinate pair.

Parameters:
cell - the given cell.
Returns:
the coordinates of the given cell.
Throws:
NullPointerException - if the cell is null.
IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.

contents

public String[][] contents()
Returns the String representation of the cells in the in this fixture's JTable, using this fixture's JTableCellReader.

Returns:
the String representation of the cells in thi fixture's JTable.
See Also:
cellReader(JTableCellReader)

rowCount

public int rowCount()
Returns the number of rows that can be shown in this fixture's JTable, given unlimited space.

Returns:
the number of rows shown in this fixture's JTable.
See Also:
JTable.getRowCount()

valueAt

public String valueAt(TableCell cell)
Returns the String representation of the value of a cell in this fixture's JTable, using this fixture's JTableCellReader.

Parameters:
cell - the given cell.
Returns:
the String representation of the value of a cell in this fixture's JTable.
Throws:
NullPointerException - if the cell is null.
IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.
See Also:
cellReader(JTableCellReader)

selectCell

public JTableFixture selectCell(TableCell cell)
Simulates a user selecting the given cell (row and column) of this fixture's JTable.

Parameters:
cell - the cell to select.
Returns:
this fixture.
Throws:
NullPointerException - if the cell is null.
IllegalStateException - if this fixture's JTable is disabled.
IllegalStateException - if this fixture's JTable is not showing on the screen.
IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.

selectCells

public JTableFixture selectCells(TableCell... cells)
Simulates a user selecting the given cells of this fixture's JTable.

Parameters:
cells - the cells to select.
Returns:
this fixture.
Throws:
NullPointerException - if cells is null or empty.
IllegalArgumentException - if cells is null or empty.
IllegalStateException - if this fixture's JTable is disabled.
IllegalStateException - if this fixture's JTable is not showing on the screen.
NullPointerException - if any element in cells is null.
IndexOutOfBoundsException - if any of the indices of any of the cells are out of bounds.

selectRows

public JTableFixture selectRows(int... rows)
Simulates a user selecting the given rows in this fixture's JTable.

Parameters:
rows - the indices of the row to select.
Returns:
this fixture.
Throws:
NullPointerException - if the given array of indices is null.
IllegalArgumentException - if the given array of indices is empty.
IllegalStateException - if this fixture's JTable is disabled.
IllegalStateException - if this fixture's JTable is not showing on the screen.
IndexOutOfBoundsException - if any of the given indices is out of bounds.
Since:
1.2

drag

public JTableFixture drag(TableCell cell)
Simulates a user dragging an item from this fixture's JTable.

Parameters:
cell - the cell to drag.
Returns:
this fixture.
Throws:
NullPointerException - if the cell is null.
IllegalStateException - if this fixture's JTable is disabled.
IllegalStateException - if this fixture's JTable is not showing on the screen.
IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.

drop

public JTableFixture drop(TableCell cell)
Simulates a user dropping an item to this fixture's JTable.

Parameters:
cell - the cell to drop the dragging item into.
Returns:
this fixture.
Throws:
NullPointerException - if the cell is null.
IllegalStateException - if this fixture's JTable is disabled.
IllegalStateException - if this fixture's JTable is not showing on the screen.
IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.

click

public JTableFixture click()
Simulates a user clicking this fixture's JTable.

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

click

public JTableFixture click(MouseButton button)
Simulates a user clicking this fixture's JTable.

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 JTable is disabled.
IllegalStateException - if this fixture's JTable is not showing on the screen.

click

public JTableFixture click(MouseClickInfo mouseClickInfo)
Simulates a user clicking this fixture's JTable.

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 JTable is disabled.
IllegalStateException - if this fixture's JTable is not showing on the screen.

click

public JTableFixture click(TableCell cell,
                           MouseButton button)
Simulates a user clicking a cell in this fixture's JTable once, using the specified mouse button.

Parameters:
cell - the cell to click.
button - the mouse button to use.
Returns:
this fixture.
Throws:
NullPointerException - if the cell is null.
IllegalStateException - if this fixture's JTable is disabled.
IllegalStateException - if this fixture's JTable is not showing on the screen.
IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.

click

public JTableFixture click(TableCell cell,
                           MouseClickInfo mouseClickInfo)
Simulates a user clicking a cell in this fixture's JTable, using the specified mouse button the given number of times.

Parameters:
cell - the cell to click.
mouseClickInfo - specifies the mouse button to use and how many times to click.
Returns:
this fixture.
Throws:
NullPointerException - if the given MouseClickInfo is null.
NullPointerException - if the cell is null.
IllegalStateException - if this fixture's JTable is disabled.
IllegalStateException - if this fixture's JTable is not showing on the screen.
IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.

doubleClick

public JTableFixture doubleClick()
Simulates a user double-clicking this fixture's JTable.

Note: This method will not be successful if the double-clicking occurs on an editable table cell. For this particular case, this method will start edition of the table cell located under the mouse pointer.

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

rightClick

public JTableFixture rightClick()
Simulates a user right-clicking this fixture's JTable.

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

pressAndReleaseKey

public JTableFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
Simulates a user pressing given key with the given modifiers on this fixture's JTable. 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 JTable is disabled.
IllegalStateException - if this fixture's JTable is not showing on the screen.
See Also:
KeyPressInfo

pressAndReleaseKeys

public JTableFixture pressAndReleaseKeys(int... keyCodes)
Simulates a user pressing and releasing the given keys on this fixture's JTable. This method does not affect the current focus.

Specified by:
pressAndReleaseKeys in interface KeyboardInputSimulationFixture
Parameters:
keyCodes - one or more 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 JTable is disabled.
IllegalStateException - if this fixture's JTable is not showing on the screen.
See Also:
KeyEvent

pressKey

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

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 JTable is disabled.
IllegalStateException - if this fixture's JTable is not showing on the screen.
See Also:
KeyEvent

releaseKey

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

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

focus

public JTableFixture focus()
Gives input focus to this fixture's JTable.

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

enterValue

public JTableFixture enterValue(TableCell cell,
                                String value)
Enters the given value in the given cell of this fixture's JTable, using this fixture's JTableCellWriter. If you need more flexibility for editing cell, please see JTableCellFixture.editor().

Parameters:
cell - the given cell.
value - the given value.
Returns:
this fixture.
Throws:
NullPointerException - if the cell is null.
IllegalStateException - if this fixture's JTable is disabled.
IllegalStateException - if this fixture's JTable is not showing on the screen.
IllegalStateException - if this fixture's JTable is not editable.
IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.
ActionFailedException - if this fixture's JTableCellValueReader is unable to enter the given value.
See Also:
cellWriter(JTableCellWriter), JTableCellFixture.editor()

cellReader

public JTableFixture cellReader(JTableCellReader cellReader)
Updates the implementation of JTableCellReader to use when comparing internal values of this fixture's JTable and the values expected in a test. The default implementation to use is BasicJTableCellReader.

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

requireRowCount

public JTableFixture requireRowCount(int expected)
Asserts that this fixture's JTable has the given number of rows.

Parameters:
expected - the expected number of rows.
Returns:
this fixture.
Throws:
AssertionError - if this fixture's JTable does not have the given number of rows.

requireSelectedRows

public JTableFixture requireSelectedRows(int... rows)
Asserts that the set of selected rows in this fixture's JTable contains to the given row indices. The given row indices can be a subset of all the selected rows in a JTable.

Parameters:
rows - the indices of the rows expected to be selected.
Returns:
this fixture.
Throws:
AssertionError - if the set of selected rows in this fixture's JTable (if any) do not contain the given indices.
Since:
1.2

requireColumnCount

public JTableFixture requireColumnCount(int expected)
Asserts that this fixture's JTable has the given number of columns.

Parameters:
expected - the expected number of columns.
Returns:
this fixture.
Throws:
AssertionError - if this fixture's JTable does not have the given number of columns.

requireFocused

public JTableFixture requireFocused()
Asserts that this fixture's JTable has input focus.

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

requireEnabled

public JTableFixture requireEnabled()
Asserts that this fixture's JTable is enabled.

Specified by:
requireEnabled in interface StateVerificationFixture
Returns:
this fixture.
Throws:
AssertionError - is the managed JTable is disabled.

requireEnabled

public JTableFixture requireEnabled(Timeout timeout)
Asserts that this fixture's JTable 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 the managed JTable is never enabled.

requireDisabled

public JTableFixture requireDisabled()
Asserts that this fixture's JTable is disabled.

Specified by:
requireDisabled in interface StateVerificationFixture
Returns:
this fixture.
Throws:
AssertionError - is the managed JTable is enabled.

requireVisible

public JTableFixture requireVisible()
Asserts that this fixture's JTable is visible.

Specified by:
requireVisible in interface StateVerificationFixture
Returns:
this fixture.
Throws:
AssertionError - if the managed JTable is not visible.

requireNotVisible

public JTableFixture requireNotVisible()
Asserts that this fixture's JTable is not visible.

Specified by:
requireNotVisible in interface StateVerificationFixture
Returns:
this fixture.
Throws:
AssertionError - if the managed JTable is visible.

requireToolTip

public JTableFixture requireToolTip(String expected)
Asserts that the toolTip in this fixture's JTable 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 JTable does not match the given value.
Since:
1.2

requireToolTip

public JTableFixture requireToolTip(Pattern pattern)
Asserts that the toolTip in this fixture's JTable 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 JTable does not match the given regular expression pattern.
Since:
1.2

requireEditable

public JTableFixture requireEditable(TableCell cell)
Asserts that the given cell in this fixture's JTable is editable.

Parameters:
cell - the given cell.
Returns:
this fixture.
Throws:
NullPointerException - if the cell is null.
IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.
AssertionError - if the given cell is not editable.

requireNotEditable

public JTableFixture requireNotEditable(TableCell cell)
Asserts that the given cell in this fixture's JTable is not editable.

Parameters:
cell - the given cell.
Returns:
this fixture.
Throws:
NullPointerException - if the cell is null.
IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.
AssertionError - if the given cell is editable.

requireNoSelection

public JTableFixture requireNoSelection()
Verifies that this fixture's JTable does not have any selection.

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

requireCellValue

public JTableFixture requireCellValue(TableCell cell,
                                      String value)
Asserts that the value of the given cell matches the given value.

Parameters:
cell - the given table cell.
value - the expected value. It can be a regular expression.
Returns:
this fixture.
Throws:
NullPointerException - if the cell is null.
IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.
AssertionError - if the value of the given cell does not match the given value.

requireCellValue

public JTableFixture requireCellValue(TableCell cell,
                                      Pattern pattern)
Asserts that the value of the given cell matches the given regular expression pattern.

Parameters:
cell - the given table cell.
pattern - the regular expression pattern to match.
Returns:
this fixture.
Throws:
NullPointerException - if the cell is null.
NullPointerException - if the given regular expression pattern is null.
IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.
AssertionError - if the value of the given cell does not match the given regular expression pattern.
Since:
1.2

requireContents

public JTableFixture requireContents(String[][] contents)
Asserts that the String representation of the cell values in this fixture's JTable is equal to the given String array. This method uses this fixture's JTableCellReader to read the values of the table cells as Strings.

Parameters:
contents - the expected String representation of the cell values in this fixture's JTable.
Returns:
this fixture.
See Also:
cellReader(JTableCellReader)

cellWriter

public JTableFixture cellWriter(JTableCellWriter cellWriter)
Updates the implementation of JTableCellWriter to use when comparing internal values of this fixture's JTable and the values expected in a test. The default implementation to use is BasicJTableCellWriter.

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

columnIndexFor

public int columnIndexFor(Object columnName)
Returns the index of the column in this fixture's JTable whose name matches the given one.

Parameters:
columnName - the name of the column to look for.
Returns:
the index of the column whose name matches the given one.
Throws:
ActionFailedException - if a column with a matching name could not be found.

clientProperty

public Object clientProperty(Object key)
Returns the client property stored in this fixture's JTable, 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 JTable 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 JTable is disabled.
IllegalStateException - if this fixture's JTable 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 JTable 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 JTable is disabled.
IllegalStateException - if this fixture's JTable is not showing on the screen.
ComponentLookupException - if a pop-up menu cannot be found.

showPopupMenuAt

public JPopupMenuFixture showPopupMenuAt(TableCell cell)
Shows a pop-up menu at the given cell.

Parameters:
cell - the table cell where to show the pop-up menu.
Returns:
a fixture that manages the displayed pop-up menu.
Throws:
NullPointerException - if the cell is null.
IllegalStateException - if this fixture's JTable is disabled.
IllegalStateException - if this fixture's JTable is not showing on the screen.
ComponentLookupException - if a pop-up menu cannot be found.


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