public class TableAssert<R,C,V> extends org.assertj.core.api.AbstractAssert<TableAssert<R,C,V>,com.google.common.collect.Table<R,C,V>>
Modifier | Constructor and Description |
---|---|
protected |
TableAssert(com.google.common.collect.Table<R,C,V> actual) |
Modifier and Type | Method and Description |
---|---|
TableAssert<R,C,V> |
containsCell(R row,
C column,
V expectedValue)
Verifies that the actual
Table contains the mapping of row/column to value. |
TableAssert<R,C,V> |
containsColumns(C... columns)
Verifies that the actual
Table contains the given columns. |
TableAssert<R,C,V> |
containsRows(R... rows)
Verifies that the actual
Table contains the given rows. |
TableAssert<R,C,V> |
containsValues(V... values)
Verifies that the actual
Table contains the given values for any key. |
TableAssert<R,C,V> |
hasColumnCount(int expectedSize)
Verifies that the actual
Table has the expected number of columns. |
TableAssert<R,C,V> |
hasRowCount(int expectedSize)
Verifies that the actual
Table has the expected number of rows. |
TableAssert<R,C,V> |
hasSize(int expectedSize)
Verifies that the actual
Table has the expected number of cells. |
void |
isEmpty()
Verifies that the actual
Table is empty. |
as, as, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, inBinary, inHexadecimal, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, overridingErrorMessage, usingComparator, usingDefaultComparator
public TableAssert<R,C,V> hasRowCount(int expectedSize)
Table
has the expected number of rows.
Example :
Tableactual = HashBasedTable.create(); actual.put(1, 3, "Millard Fillmore"); actual.put(1, 4, "Franklin Pierce"); actual.put(2, 5, "Grover Cleveland"); assertThat(actual).hasRowCount(2);
expectedSize
- The columns to look for in the actual Table
TableAssert
for assertion chaining.IllegalArgumentException
- if the expected size is negativeAssertionError
- if the actual Table
is null
.AssertionError
- if the actual Table
does not have the expected row size.public TableAssert<R,C,V> hasColumnCount(int expectedSize)
Table
has the expected number of columns.
Example :
Tableactual = HashBasedTable.create(); actual.put(1, 3, "Millard Fillmore"); actual.put(1, 4, "Franklin Pierce"); actual.put(2, 5, "Grover Cleveland"); assertThat(actual).hasColumnCount(3);
expectedSize
- The columns to look for in the actual Table
TableAssert
for assertion chaining.IllegalArgumentException
- if the expected size is negativeAssertionError
- if the actual Table
is null
.AssertionError
- if the actual Table
does not have the expected column size.public TableAssert<R,C,V> hasSize(int expectedSize)
Table
has the expected number of cells.
Example :
Tableactual = HashBasedTable.create(); actual.put(1, 3, "Millard Fillmore"); actual.put(1, 4, "Franklin Pierce"); actual.put(2, 5, "Grover Cleveland"); assertThat(actual).hasSize(3);
expectedSize
- The columns to look for in the actual Table
TableAssert
for assertion chaining.IllegalArgumentException
- if the expected size is negativeAssertionError
- if the actual Table
is null
.AssertionError
- if the actual Table
does not have the expected number of cells.public TableAssert<R,C,V> containsRows(R... rows)
Table
contains the given rows.
Example :
Tableactual = HashBasedTable.create(); actual.put(1, 3, "Millard Fillmore"); actual.put(1, 4, "Franklin Pierce"); actual.put(2, 5, "Grover Cleveland"); assertThat(actual).containsRows(1, 2);
rows
- The columns to look for in the actual Table
TableAssert
for assertion chaining.IllegalArgumentException
- if no param rows have been set.AssertionError
- if the actual Table
is null
.AssertionError
- if the actual Table
does not contain the given rows.public TableAssert<R,C,V> containsColumns(C... columns)
Table
contains the given columns.
Example :
Tableactual = HashBasedTable.create(); actual.put(1, 3, "Millard Fillmore"); actual.put(1, 4, "Franklin Pierce"); actual.put(2, 5, "Grover Cleveland"); assertThat(actual).containsColumns(3, 4);
columns
- The columns to look for in the actual Table
TableAssert
for assertion chaining.IllegalArgumentException
- if no param columns have been set.AssertionError
- if the actual Table
is null
.AssertionError
- if the actual Table
does not contain the given columns.public TableAssert<R,C,V> containsValues(V... values)
Table
contains the given values for any key.
Example :
Tableactual = HashBasedTable.create(); actual.put(1, 3, "Millard Fillmore"); actual.put(1, 4, "Franklin Pierce"); actual.put(2, 5, "Grover Cleveland"); assertThat(actual).containsValues("Franklin Pierce", "Millard Fillmore");
values
- The values to look for in the actual Table
TableAssert
for assertion chaining.IllegalArgumentException
- if no param values have been set.AssertionError
- if the actual Table
is null
.AssertionError
- if the actual Table
does not contain the given values.public TableAssert<R,C,V> containsCell(R row, C column, V expectedValue)
Table
contains the mapping of row/column to value.
Example :
Tableactual = HashBasedTable.create(); actual.put(1, 3, "Millard Fillmore"); actual.put(1, 4, "Franklin Pierce"); actual.put(2, 5, "Grover Cleveland"); assertThat(actual).containsCell(1, 3, "Millard Fillmore");
row
- The row key to lookup in the actual Table
column
- The column key to lookup in the actual Table
value
- The value to look for in the actual Table
TableAssert
for assertion chaining.AssertionError
- if the actual Table
is null
.AssertionError
- if the row key is null
.AssertionError
- if the column key is null
.AssertionError
- if the expected value is null
.public void isEmpty()
Table
is empty.
Example :
Tableactual = HashBasedTable.create(); assertThat(actual).isEmpty();
AssertionError
- if the actual Table
is null
.AssertionError
- if the actual Table
is not empty.Copyright © 2014 AssertJ. All Rights Reserved.