public class JTableCellFixture extends Object implements ItemFixture<JTableCellFixture>
Supports functional testing of single cells in JTables.
Example:
// import static org.assertj.swing.data.TableCell.row;JTableCellFixturecell = dialog.table("records").cell(row(3).column(0)); cell.select().showPopupMenu();
TableCell| Modifier | Constructor and Description |
|---|---|
protected |
JTableCellFixture(JTableFixture table,
TableCell cell)
Creates a new
JTableCellFixture. |
| Modifier and Type | Method and Description |
|---|---|
ColorFixture |
background()
Returns a fixture that verifies the background color of this fixture's table cell.
|
JTableCellFixture |
cancelEditing()
Cancels editing this fixture's table cell.
|
JTableCellFixture |
click()
Simulates a user clicking this fixture's table cell.
|
JTableCellFixture |
click(MouseButton button)
Simulates a user clicking a cell in this fixture's table cell once, using the specified mouse button.
|
JTableCellFixture |
click(MouseClickInfo mouseClickInfo)
Simulates a user clicking this fixture's table cell.
|
int |
column() |
JTableCellFixture |
doubleClick()
Simulates a user double-clicking this fixture's table cell.
|
JTableCellFixture |
drag()
Simulates a user dragging this fixture's table cell.
|
JTableCellFixture |
drop()
Simulates a user dropping into this fixture's table cell.
|
Component |
editor()
Returns the editor of this fixture's table cell.
|
JTableCellFixture |
enterValue(String value)
Enters the given value to this fixture's table cell.
|
FontFixture |
font()
Returns a fixture that verifies the font of this fixture's table cell.
|
ColorFixture |
foreground()
Returns a fixture that verifies the foreground color of this fixture's table cell.
|
JTableCellFixture |
requireEditable()
Asserts that this fixture's table cell is editable.
|
JTableCellFixture |
requireNotEditable()
Asserts that this fixture's table cell is not editable.
|
JTableCellFixture |
requireValue(Pattern pattern)
Asserts that the value of this fixture's table cell matches the given regular expression pattern.
|
JTableCellFixture |
requireValue(String value)
Asserts that the value of this fixture's table cell matches the given value.
|
JTableCellFixture |
rightClick()
Simulates a user right-clicking this fixture's table cell.
|
int |
row() |
JTableCellFixture |
select()
Simulates a user selecting this fixture's table cell.
|
JPopupMenuFixture |
showPopupMenu()
Shows a pop-up menu using this fixture's table cell as the invoker of the pop-up menu.
|
JTableCellFixture |
startEditing()
Starts editing this fixture's table cell.
|
JTableCellFixture |
stopEditing()
Stops editing this fixture's table cell.
|
String |
value()
Returns the
String representation of the value of this fixture's table cell. |
protected JTableCellFixture(@Nonnull JTableFixture table, @Nonnull TableCell cell)
JTableCellFixture.table - handles the JTable containing the cell in this fixture.cell - row and column indices of the table cell to be managed by this fixture.NullPointerException - if table is null.NullPointerException - if cell is null.@Nonnull public JTableCellFixture select()
select in interface ItemFixture<JTableCellFixture>IllegalStateException - if this fixture's JTable is disabled.IllegalStateException - if this fixture's JTable is not showing on the screen.@Nonnull public JTableCellFixture click()
click in interface MouseInputSimulationFixture<JTableCellFixture>IllegalStateException - if this fixture's JTable is disabled.IllegalStateException - if this fixture's JTable is not showing on the screen.@Nonnull public JTableCellFixture click(@Nonnull MouseClickInfo mouseClickInfo)
click in interface MouseInputSimulationFixture<JTableCellFixture>mouseClickInfo - 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.@Nonnull public JTableCellFixture doubleClick()
doubleClick in interface MouseInputSimulationFixture<JTableCellFixture>IllegalStateException - if this fixture's JTable is disabled.IllegalStateException - if this fixture's JTable is not showing on the screen.@Nonnull public JTableCellFixture rightClick()
rightClick in interface MouseInputSimulationFixture<JTableCellFixture>IllegalStateException - if this fixture's JTable is disabled.IllegalStateException - if this fixture's JTable is not showing on the screen.@Nonnull public JTableCellFixture click(@Nonnull MouseButton button)
click in interface MouseInputSimulationFixture<JTableCellFixture>button - the mouse button to use.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.@Nonnull public JTableCellFixture startEditing()
Component returned by editor().
This method uses the JTableCellWriter from the JTableFixture that created this fixture.
IllegalStateException - if this fixture's JTable is disabled.IllegalStateException - if this fixture's JTable is not showing on the screen.IllegalStateException - if this cell is not editable.IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.ActionFailedException - if this writer is unable to handle the underlying cell editor.JTableFixture.replaceCellWriter(JTableCellWriter),
JTableCellWriter,
editor()@Nonnull public JTableCellFixture stopEditing()
Component returned by editor().
This method uses the JTableCellWriter from the JTableFixture that created this fixture.
IllegalStateException - if this fixture's JTable is disabled.IllegalStateException - if this fixture's JTable is not showing on the screen.IllegalStateException - if this cell is not editable.IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.ActionFailedException - if this writer is unable to handle the underlying cell editor.JTableFixture.replaceCellWriter(JTableCellWriter),
JTableCellWriter,
editor()@Nonnull public JTableCellFixture cancelEditing()
Component returned by editor().
TableCellFixture cell = table.cell(row(6).column(8));
Component editor = cell.editor();
// assume editor is a JTextField
JTextComponentFixture editorFixture = new JTextComponentFixture(robot, (JTextField) editor);
cell.startEditing();
editorFixture.enterText("Hello");
// discard any entered value
cell.cancelEditing();
This method uses the JTableCellWriter from the JTableFixture that created this fixture.
IllegalStateException - if this fixture's JTable is disabled.IllegalStateException - if this fixture's JTable is not showing on the screen.IllegalStateException - if this cell is not editable.IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.ActionFailedException - if this writer is unable to handle the underlying cell editor.JTableFixture.replaceCellWriter(JTableCellWriter),
JTableCellWriter,
editor()public Component editor()
ComponentFixture,) the method startEditing() should be called first. To apply any changes back to
the table cell(), the method stopEditing() should be called. This method uses the JTableCellWriter
from the JTableFixture that created this fixture.
Example:
TableCellFixture cell = table.cell(row(6).column(8)); Component editor = cell.editor(); // assume editor is a JTextField JTextComponentFixture editorFixture = new JTextComponentFixture(robot, (JTextField) editor); cell.startEditing(); editorFixture.enterText("Hello"); cell.stopEditing();
JTableFixture.replaceCellWriter(JTableCellWriter),
JTableCellWriter@Nonnull public JTableCellFixture enterValue(@Nonnull String value)
editor().
This method uses the JTableCellWriter from the JTableFixture that created this fixture.
value - the value to enter in the cell.IllegalStateException - if this fixture's JTable is disabled.IllegalStateException - if this fixture's JTable is not showing on the screen.IllegalStateException - if this cell is not editable.IndexOutOfBoundsException - if any of the indices (row and column) is out of bounds.ActionFailedException - if this driver's JTableCellValueReader is unable to enter the given value.JTableFixture.replaceCellWriter(JTableCellWriter),
JTableCellWriter@Nonnull public JTableCellFixture requireValue(@Nullable String value)
value - the expected value of this fixture's table cell. It can be a regular expression.AssertionError - if the value of this fixture's table cell does not match the expected one.@Nonnull public JTableCellFixture requireValue(@Nonnull Pattern pattern)
pattern - the regular expression pattern to match.NullPointerException - if the given regular expression pattern is null.AssertionError - if the value of this fixture's table cell does not match the expected the given regular
expression pattern.public FontFixture font()
JTableCellReader from the JTableFixture that created this fixture.JTableFixture.replaceCellReader(JTableCellReader),
JTableCellReader@Nonnull public ColorFixture background()
JTableCellReader from the JTableFixture that created this fixture.JTableFixture.replaceCellReader(JTableCellReader),
JTableCellReader@Nonnull public ColorFixture foreground()
JTableCellReader from the JTableFixture that created this fixture.JTableFixture.replaceCellReader(JTableCellReader),
JTableCellReader@Nullable public String value()
String representation of the value of this fixture's table cell. This method uses the
JTableCellReader from the JTableFixture that created this fixture.value in interface ItemFixture<JTableCellFixture>String representation of the value of this fixture's table cell.JTableFixture.replaceCellReader(JTableCellReader),
JTableCellReader@Nonnull public JTableCellFixture drag()
drag in interface ItemFixture<JTableCellFixture>@Nonnull public JTableCellFixture drop()
drop in interface ItemFixture<JTableCellFixture>@Nonnull public JPopupMenuFixture showPopupMenu()
showPopupMenu in interface ItemFixture<JTableCellFixture>ComponentLookupException - if a pop-up menu cannot be found.@Nonnull public JTableCellFixture requireEditable()
AssertionError - if this fixture's table cell is not editable.@Nonnull public JTableCellFixture requireNotEditable()
AssertionError - if this fixture's table cell is editable.public int row()
public int column()
Copyright © 2014 AssertJ. All rights reserved.