Module org.testfx
Package org.testfx.assertions.api
Class AbstractTableViewAssert<SELF extends AbstractTableViewAssert<SELF,T>,T>
- java.lang.Object
-
- org.assertj.core.api.AbstractAssert<SELF,javafx.css.Styleable>
-
- org.testfx.assertions.api.AbstractStyleableAssert<SELF>
-
- org.testfx.assertions.api.AbstractNodeAssert<SELF>
-
- org.testfx.assertions.api.AbstractTableViewAssert<SELF,T>
-
- All Implemented Interfaces:
org.assertj.core.api.Assert<SELF,javafx.css.Styleable>
,org.assertj.core.api.Descriptable<SELF>
,org.assertj.core.api.ExtensionPoints<SELF,javafx.css.Styleable>
- Direct Known Subclasses:
TableViewAssert
public class AbstractTableViewAssert<SELF extends AbstractTableViewAssert<SELF,T>,T> extends AbstractNodeAssert<SELF>
Base class for allTableView
assertions.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractTableViewAssert(javafx.scene.control.TableView<T> actual, Class<?> selfType)
-
Method Summary
Modifier and Type Method Description SELF
containsRow(Object... cells)
Verifies that the actualTableView
contains the given tablecells
at any row index.SELF
containsRowAtIndex(int rowIndex, Object... cells)
Verifies that the actualTableView
contains the given tablecells
at the givenrowIndex
.SELF
doesNotContainRow(Object... cells)
Verifies that the actualTableView
does not contain the given tablecells
at any row index.SELF
doesNotContainRowAtIndex(int rowIndex, Object... cells)
Verifies that the actualTableView
does not contain the given tablecells
at the givenrowIndex
.SELF
doesNotHaveExactlyNumRows(int rows)
Verifies that the actualTableView
does not have exactly the givenamount
of rows.SELF
doesNotHaveTableCell(Object expectedValue)
Verifies that the actualTableView
does not contain the given table cellexpectedValue
.SELF
hasExactlyNumRows(int rows)
Verifies that the actualTableView
has exactly the givenamount
of rows.SELF
hasTableCell(Object expectedValue)
Verifies that the actualTableView
contains the given table cellexpectedValue
.-
Methods inherited from class org.testfx.assertions.api.AbstractNodeAssert
doesNotHaveChild, hasChild, hasExactlyChildren, isDisabled, isEnabled, isFocused, isInvisible, isNotFocused, isVisible
-
Methods inherited from class org.testfx.assertions.api.AbstractStyleableAssert
doesNotHaveId, doesNotHaveStyle, doesNotHaveStyleableParent, doesNotHaveTypeSelector, hasId, hasStyle, hasStyleableParent, hasTypeSelector
-
Methods inherited from class org.assertj.core.api.AbstractAssert
as, as, asInstanceOf, asList, asString, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, inHexadecimal, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, setCustomRepresentation, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, withFailMessage, withRepresentation, withThreadDumpOnError
-
-
-
-
Method Detail
-
hasTableCell
public SELF hasTableCell(Object expectedValue)
Verifies that the actualTableView
contains the given table cellexpectedValue
.Test code must ensure that the cell is visible by scrolling it into the viewport before using the matcher:
int row = ... int col = ... tableView.scrollTo(row); tableView.scrollToColumn(col); verifyThat(tableView, hasTableCell(contentOfCell);
- Parameters:
expectedValue
- the given table cell value to ensure theTableView
contains- Returns:
- this assertion object
-
doesNotHaveTableCell
public SELF doesNotHaveTableCell(Object expectedValue)
Verifies that the actualTableView
does not contain the given table cellexpectedValue
.- Parameters:
expectedValue
- the given table cell value to ensure theTableView
does not contain- Returns:
- this assertion object
-
hasExactlyNumRows
public SELF hasExactlyNumRows(int rows)
Verifies that the actualTableView
has exactly the givenamount
of rows.- Parameters:
rows
- the given amount of rows to compare the actual amount of rows to- Returns:
- this assertion object
-
doesNotHaveExactlyNumRows
public SELF doesNotHaveExactlyNumRows(int rows)
Verifies that the actualTableView
does not have exactly the givenamount
of rows.- Parameters:
rows
- the given amount of rows to compare the actual amount of rows to- Returns:
- this assertion object
-
containsRowAtIndex
public SELF containsRowAtIndex(int rowIndex, Object... cells)
Verifies that the actualTableView
contains the given tablecells
at the givenrowIndex
.For example, given a
TableView
that has three columns:
Then to verify that such aTableColumn<RegularPolygon, String> nameColumn = new TableColumn<>("Name"); TableColumn<RegularPolygon, Integer> numSidesColumn = new TableColumn<>("Number of Sides"); TableColumn<RegularPolygon, Double> unitAreaColumn = new TableColumn<>("Area when Side = 1"); polygonsTable.getColumns().setAll(nameColumn, numSidesColumn, unitAreaColumn);
TableView
, contains, at index 3, a row for aRegularPolygon
that has the name "Pentagon", the number of sides 5, and a unit area of 1.720477401 one would use:
Where the types of each argument, after the row index, correspond to the types of theassertThat(polygonsTable).containsRowAtIndex(3, "Pentagon", 5, 1.720477401);
TableColumn
s which in our example is(String, Integer, Double)
.- Parameters:
rowIndex
- the given row index that the actualTableView
should contain the given cells oncells
- the cells that should be contained at the given row index- Returns:
- this assertion object
-
doesNotContainRowAtIndex
public SELF doesNotContainRowAtIndex(int rowIndex, Object... cells)
Verifies that the actualTableView
does not contain the given tablecells
at the givenrowIndex
.- Parameters:
rowIndex
- the given row index that the actualTableView
should not contain the given cells oncells
- the cells that should not be contained at the given row index- Returns:
- this assertion object
-
containsRow
public SELF containsRow(Object... cells)
Verifies that the actualTableView
contains the given tablecells
at any row index.For example, given a
TableView
that has three columns:
Then to verify that such aTableColumn<Person, String> nameColumn = new TableColumn<>("Name"); TableColumn<Person, Double> bmiColumn = new TableColumn<>("Body Mass Index"); TableColumn<Person, Boolean> membershipColumn = new TableColumn<>("Gym Membership Valid"); fitnessTable.getColumns().setAll(nameColumn, bmiColumn, membershipColumn);
TableView
, contains at least one row with aPerson
that has the name "Dan Anderson", the body mass index 28.83, and a valid gym membership (true) one would use:
Where the types of each argument correspond to the types of theassertThat(fitnessTable).containsRow("Dan Anderson", 28.83, true);
TableColumn
s which in our example is(String, Double, Boolean)
.- Parameters:
cells
- the cells that should be contained at any (at least one) row index- Returns:
- this assertion object
-
-