public class JTableFixture extends ComponentFixture<JTable> implements CommonComponentFixture, JComponentFixture, JPopupMenuInvokerFixture
JTables:
The conversion between the values given in tests and the values being displayed by a
renderer is performed by a JTable. This fixture uses a
JTableCellReader by default.
BasicJTableCellReader
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target| Constructor and Description |
|---|
JTableFixture(Robot robot,
JTable target)
Creates a new
. |
JTableFixture(Robot robot,
String tableName)
Creates a new
. |
| Modifier and Type | Method and Description |
|---|---|
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
. |
JTableFixture |
cellReader(JTableCellReader cellReader)
Updates the implementation of
to use when comparing internal values of this
fixture's and the values expected in a test. |
JTableFixture |
cellWriter(JTableCellWriter cellWriter)
Updates the implementation of
to use when comparing internal values of this
fixture's and the values expected in a test. |
JTableFixture |
click()
Simulates a user clicking this fixture's
. |
JTableFixture |
click(MouseButton button)
Simulates a user clicking this fixture's
. |
JTableFixture |
click(MouseClickInfo mouseClickInfo)
Simulates a user clicking this fixture's
. |
JTableFixture |
click(TableCell cell,
MouseButton button)
Simulates a user clicking a cell in this fixture's
once, using the specified mouse
button. |
JTableFixture |
click(TableCell cell,
MouseClickInfo mouseClickInfo)
Simulates a user clicking a cell in this fixture's
, using the specified mouse button
the given number of times. |
Object |
clientProperty(Object key)
Returns the client property stored in this fixture's
, under the given key. |
int |
columnIndexFor(Object columnName)
Returns the index of the column in this fixture's
whose name matches the given one. |
String[][] |
contents()
Returns the
String representation of the cells in the in this fixture's ,
using this fixture's . |
JTableFixture |
doubleClick()
Simulates a user double-clicking this fixture's
. |
JTableFixture |
drag(TableCell cell)
Simulates a user dragging an item from this fixture's
. |
protected JTableDriver |
driver()
Returns the
used by this fixture. |
protected void |
driver(JTableDriver newDriver)
Sets the
to be used by this fixture. |
JTableFixture |
drop(TableCell cell)
Simulates a user dropping an item to this fixture's
. |
JTableFixture |
enterValue(TableCell cell,
String value)
Enters the given value in the given cell of this fixture's
, using this fixture's
. |
JTableFixture |
focus()
Gives input focus to this fixture's
. |
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
. |
JTableFixture |
pressAndReleaseKeys(int... keyCodes)
Simulates a user pressing and releasing the given keys on this fixture's
. |
JTableFixture |
pressKey(int keyCode)
Simulates a user pressing the given key on this fixture's
. |
JTableFixture |
releaseKey(int keyCode)
Simulates a user releasing the given key on this fixture's
. |
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
has the given number of columns. |
JTableFixture |
requireContents(String[][] contents)
Asserts that the
String representation of the cell values in this fixture's
is equal to the given String array. |
JTableFixture |
requireDisabled()
Asserts that this fixture's
is disabled. |
JTableFixture |
requireEditable(TableCell cell)
Asserts that the given cell in this fixture's
is editable. |
JTableFixture |
requireEnabled()
Asserts that this fixture's
is enabled. |
JTableFixture |
requireEnabled(Timeout timeout)
Asserts that this fixture's
is enabled. |
JTableFixture |
requireFocused()
Asserts that this fixture's
has input focus. |
JTableFixture |
requireNoSelection()
Verifies that this fixture's
does not have any selection. |
JTableFixture |
requireNotEditable(TableCell cell)
Asserts that the given cell in this fixture's
is not editable. |
JTableFixture |
requireNotVisible()
Asserts that this fixture's
is not visible. |
JTableFixture |
requireRowCount(int expected)
Asserts that this fixture's
has the given number of rows. |
JTableFixture |
requireSelectedRows(int... rows)
Asserts that the set of selected rows in this fixture's
contains to the given row
indices. |
JTableFixture |
requireToolTip(Pattern pattern)
Asserts that the toolTip in this fixture's
matches the given regular expression
pattern. |
JTableFixture |
requireToolTip(String expected)
Asserts that the toolTip in this fixture's
matches the given value. |
JTableFixture |
requireVisible()
Asserts that this fixture's
is visible. |
JTableFixture |
rightClick()
Simulates a user right-clicking this fixture's
. |
int |
rowCount()
Returns the number of rows that can be shown in this fixture's
, given unlimited space. |
JTableFixture |
selectCell(TableCell cell)
Simulates a user selecting the given cell (row and column) of this fixture's
. |
JTableFixture |
selectCells(TableCell... cells)
Simulates a user selecting the given cells of this fixture's
. |
String |
selectionValue()
Returns the
String representation of the selected cell in this fixture's ,
using this fixture's . |
JTableFixture |
selectRows(int... rows)
Simulates a user selecting the given rows in this fixture's
. |
JPopupMenuFixture |
showPopupMenu()
Shows a pop-up menu using this fixture's
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
as the invoker of the
pop-up menu. |
JPopupMenuFixture |
showPopupMenuAt(TableCell cell)
Shows a pop-up menu at the given cell.
|
JTableHeaderFixture |
tableHeader()
|
String |
valueAt(TableCell cell)
Returns the
String representation of the value of a cell in this fixture's
, using this fixture's . |
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNullpublic JTableFixture(Robot robot, JTable target)
JTableFixture.robot - performs simulation of user events on the given JTable.target - the JTable to be managed by this fixture.NullPointerException - if robot is null.NullPointerException - if target is null.public JTableFixture(Robot robot, String tableName)
JTableFixture.robot - performs simulation of user events on a JTable.tableName - the name of the JTable to find using the given Robot.NullPointerException - if robot is null.ComponentLookupException - if a matching JTable could not be found.ComponentLookupException - if more than one matching JTable is found.protected final void driver(JTableDriver newDriver)
JTableDriver to be used by this fixture.newDriver - the new JTableDriver.NullPointerException - if the given driver is null.protected final JTableDriver driver()
JTableDriver used by this fixture.JTableDriver used by this fixture.public FontFixture fontAt(TableCell cell)
cell - the given table cell.NullPointerException - if the cell is null.IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.public ColorFixture backgroundAt(TableCell cell)
cell - the given table cell.NullPointerException - if the cell is null.IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.public ColorFixture foregroundAt(TableCell cell)
cell - the given table cell.NullPointerException - if the cell is null.IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.public TableCell cell(String value)
value - the value of the cell to look for. It can be a regular expression.ActionFailedException - if a cell with a matching value cannot be found.public TableCell cell(Pattern valuePattern)
valuePattern - the regular expression pattern to match.NullPointerException - if the given regular expression pattern is null.ActionFailedException - if a cell with a matching value cannot be found.public JTableCellFixture cell(TableCellFinder cellFinder)
TableCellFinder.cellFinder - knows how to find a cell.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.public JTableCellFixture cell(TableCell cell)
cell - the cell of interest.NullPointerException - if the cell is null.IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.public JTableHeaderFixture tableHeader()
JTableHeaderFixture wrapping the JTableHeader in this fixture's
JTable.AssertionError - if the JTableHeader in this fixture's JTable is null.public String selectionValue()
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.String representation of the selected cell.cellReader(JTableCellReader)public Point pointAt(TableCell cell)
cell - the given cell.NullPointerException - if the cell is null.IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.public String[][] contents()
String representation of the cells in the in this fixture's JTable,
using this fixture's JTableCellReader.String representation of the cells in thi fixture's JTable.cellReader(JTableCellReader)public int rowCount()
JTable, given unlimited space.JTable.JTable.getRowCount()public String valueAt(TableCell cell)
String representation of the value of a cell in this fixture's
JTable, using this fixture's JTableCellReader.cell - the given cell.String representation of the value of a cell in this fixture's JTable.NullPointerException - if the cell is null.IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.cellReader(JTableCellReader)public JTableFixture selectCell(TableCell cell)
JTable.cell - the cell to select.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.public JTableFixture selectCells(TableCell... cells)
JTable.cells - the cells to select.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.public JTableFixture selectRows(int... rows)
JTable.rows - the indices of the row to select.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.public JTableFixture drag(TableCell cell)
JTable.cell - the cell to drag.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.public JTableFixture drop(TableCell cell)
JTable.cell - the cell to drop the dragging item into.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.public JTableFixture click()
JTable.click in interface MouseInputSimulationFixtureIllegalStateException - if this fixture's JTable is disabled.IllegalStateException - if this fixture's JTable is not showing on the screen.public JTableFixture click(MouseButton button)
JTable.click in interface MouseInputSimulationFixturebutton - the button to click.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.public JTableFixture click(MouseClickInfo mouseClickInfo)
JTable.click in interface MouseInputSimulationFixturemouseClickInfo - specifies the button to click and the times the button should be clicked.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.public JTableFixture click(TableCell cell, MouseButton button)
JTable once, using the specified mouse
button.cell - the cell to click.button - the mouse button to use.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.public JTableFixture click(TableCell cell, MouseClickInfo mouseClickInfo)
JTable, using the specified mouse button
the given number of times.cell - the cell to click.mouseClickInfo - specifies the mouse button to use and how many times to click.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.public JTableFixture doubleClick()
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.
doubleClick in interface MouseInputSimulationFixtureIllegalStateException - if this fixture's JTable is disabled.IllegalStateException - if this fixture's JTable is not showing on the screen.public JTableFixture rightClick()
JTable.rightClick in interface MouseInputSimulationFixtureIllegalStateException - if this fixture's JTable is disabled.IllegalStateException - if this fixture's JTable is not showing on the screen.public JTableFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
JTable.
Modifiers is a mask from the available InputEvent masks.pressAndReleaseKey in interface KeyboardInputSimulationFixturekeyPressInfo - specifies the key and modifiers to press.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.KeyPressInfopublic JTableFixture pressAndReleaseKeys(int... keyCodes)
JTable. This method
does not affect the current focus.pressAndReleaseKeys in interface KeyboardInputSimulationFixturekeyCodes - one or more codes of the keys to press.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.KeyEventpublic JTableFixture pressKey(int keyCode)
JTable.pressKey in interface KeyboardInputSimulationFixturekeyCode - the code of the key to press.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.KeyEventpublic JTableFixture releaseKey(int keyCode)
JTable.releaseKey in interface KeyboardInputSimulationFixturekeyCode - the code of the key to release.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.KeyEventpublic JTableFixture focus()
JTable.focus in interface FocusableComponentFixtureIllegalStateException - if this fixture's JTable is disabled.IllegalStateException - if this fixture's JTable is not showing on the screen.public JTableFixture enterValue(TableCell cell, String value)
JTable, using this fixture's
JTableCellWriter. If you need more flexibility for editing cell, please see
JTableCellFixture.editor().cell - the given cell.value - the given value.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.cellWriter(JTableCellWriter),
JTableCellFixture.editor()public JTableFixture cellReader(JTableCellReader cellReader)
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.cellReader - the new JTableCellValueReader to use.NullPointerException - if cellReader is null.public JTableFixture requireRowCount(int expected)
JTable has the given number of rows.expected - the expected number of rows.AssertionError - if this fixture's JTable does not have the given number of rows.public JTableFixture requireSelectedRows(int... rows)
JTable contains to the given row
indices. The given row indices can be a subset of all the selected rows in a JTable.rows - the indices of the rows expected to be selected.AssertionError - if the set of selected rows in this fixture's JTable (if any) do not contain
the given indices.public JTableFixture requireColumnCount(int expected)
JTable has the given number of columns.expected - the expected number of columns.AssertionError - if this fixture's JTable does not have the given number of columns.public JTableFixture requireFocused()
JTable has input focus.requireFocused in interface FocusableComponentFixtureAssertionError - if this fixture's JTable does not have input focus.public JTableFixture requireEnabled()
JTable is enabled.requireEnabled in interface StateVerificationFixtureAssertionError - is the managed JTable is disabled.public JTableFixture requireEnabled(Timeout timeout)
JTable is enabled.requireEnabled in interface StateVerificationFixturetimeout - the time this fixture will wait for the component to be enabled.WaitTimedOutError - if the managed JTable is never enabled.public JTableFixture requireDisabled()
JTable is disabled.requireDisabled in interface StateVerificationFixtureAssertionError - is the managed JTable is enabled.public JTableFixture requireVisible()
JTable is visible.requireVisible in interface StateVerificationFixtureAssertionError - if the managed JTable is not visible.public JTableFixture requireNotVisible()
JTable is not visible.requireNotVisible in interface StateVerificationFixtureAssertionError - if the managed JTable is visible.public JTableFixture requireToolTip(String expected)
JTable matches the given value.requireToolTip in interface ToolTipDisplayFixtureexpected - the given value. It can be a regular expression.AssertionError - if the toolTip in this fixture's JTable does not match the given value.public JTableFixture requireToolTip(Pattern pattern)
JTable matches the given regular expression
pattern.requireToolTip in interface ToolTipDisplayFixturepattern - the regular expression pattern to match.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.public JTableFixture requireEditable(TableCell cell)
JTable is editable.cell - the given cell.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.public JTableFixture requireNotEditable(TableCell cell)
JTable is not editable.cell - the given cell.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.public JTableFixture requireNoSelection()
JTable does not have any selection.AssertionError - if this fixture's JTable has a selection.public JTableFixture requireCellValue(TableCell cell, String value)
cell - the given table cell.value - the expected value. It can be a regular expression.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.public JTableFixture requireCellValue(TableCell cell, Pattern pattern)
cell - the given table cell.pattern - the regular expression pattern to match.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.public JTableFixture requireContents(String[][] contents)
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.contents - the expected String representation of the cell values in this fixture's
JTable.cellReader(JTableCellReader)public JTableFixture cellWriter(JTableCellWriter cellWriter)
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.cellWriter - the new JTableCellValueWriter to use.NullPointerException - if cellWriter is null.public int columnIndexFor(Object columnName)
JTable whose name matches the given one.columnName - the name of the column to look for.ActionFailedException - if a column with a matching name could not be found.public Object clientProperty(Object key)
JTable, under the given key.clientProperty in interface ClientPropertyStorageFixturekey - the key to use to retrieve the client property.null if the property was
not found.NullPointerException - if the given key is null.public JPopupMenuFixture showPopupMenu()
JTable as the invoker of the pop-up menu.showPopupMenu in interface JPopupMenuInvokerFixtureIllegalStateException - 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.public JPopupMenuFixture showPopupMenuAt(Point p)
JTable as the invoker of the
pop-up menu.showPopupMenuAt in interface JPopupMenuInvokerFixturep - the given point where to show the pop-up menu.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.public JPopupMenuFixture showPopupMenuAt(TableCell cell)
cell - the table cell where to show the pop-up menu.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-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.