Package org.assertj.guava.api
Class TableAssert<R,C,V>
- java.lang.Object
-
- org.assertj.core.api.AbstractAssert<TableAssert<R,C,V>,com.google.common.collect.Table<R,C,V>>
-
- org.assertj.guava.api.TableAssert<R,C,V>
-
- All Implemented Interfaces:
Assert<TableAssert<R,C,V>,com.google.common.collect.Table<R,C,V>>,Descriptable<TableAssert<R,C,V>>,ExtensionPoints<TableAssert<R,C,V>,com.google.common.collect.Table<R,C,V>>
public class TableAssert<R,C,V> extends AbstractAssert<TableAssert<R,C,V>,com.google.common.collect.Table<R,C,V>>
-
-
Field Summary
-
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedTableAssert(com.google.common.collect.Table<R,C,V> actual)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcheckExpectedSizeArgument(int expectedSize)TableAssert<R,C,V>containsCell(R row, C column, V expectedValue)Verifies that the actualTablecontains the mapping of row/column to value.TableAssert<R,C,V>containsColumns(C... columns)Verifies that the actualTablecontains the given columns.TableAssert<R,C,V>containsRows(R... rows)Verifies that the actualTablecontains the given rows.TableAssert<R,C,V>containsValues(V... values)Verifies that the actualTablecontains the given values for any key.TableAssert<R,C,V>hasColumnCount(int expectedSize)Verifies that the actualTablehas the expected number of columns.TableAssert<R,C,V>hasRowCount(int expectedSize)Verifies that the actualTablehas the expected number of rows.TableAssert<R,C,V>hasSize(int expectedSize)Verifies that the actualTablehas the expected number of cells.voidisEmpty()Verifies that the actualTableis empty.TableAssert<R,C,V>isNotEmpty()Verifies that the actualTableis not empty.-
Methods inherited from class org.assertj.core.api.AbstractAssert
actual, areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, doesNotHaveToString, doesNotMatch, doesNotMatch, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, hasToString, inBinary, inHexadecimal, is, isElementOfCustomAssert, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, usingEquals, usingEquals, usingRecursiveAssertion, usingRecursiveAssertion, usingRecursiveComparison, usingRecursiveComparison, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnError
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.assertj.core.api.Descriptable
as, as, as, describedAs, describedAs
-
-
-
-
Method Detail
-
hasRowCount
public TableAssert<R,C,V> hasRowCount(int expectedSize)
Verifies that the actualTablehas the expected number of rows.Example :
Table <Integer, Integer, String> actual = HashBasedTable.create(); actual.put(1, 3, "Millard Fillmore"); actual.put(1, 4, "Franklin Pierce"); actual.put(2, 5, "Grover Cleveland"); assertThat(actual).hasRowCount(2);- Parameters:
expectedSize- The columns to look for in the actualTable- Returns:
- this
TableAssertfor assertion chaining. - Throws:
java.lang.IllegalArgumentException- if the expected size is negativejava.lang.AssertionError- if the actualTableisnull.java.lang.AssertionError- if the actualTabledoes not have the expected row size.
-
hasColumnCount
public TableAssert<R,C,V> hasColumnCount(int expectedSize)
Verifies that the actualTablehas the expected number of columns.Example :
Table<Integer, Integer, String> actual = HashBasedTable.create(); actual.put(1, 3, "Millard Fillmore"); actual.put(1, 4, "Franklin Pierce"); actual.put(2, 5, "Grover Cleveland"); assertThat(actual).hasColumnCount(3);- Parameters:
expectedSize- The columns to look for in the actualTable- Returns:
- this
TableAssertfor assertion chaining. - Throws:
java.lang.IllegalArgumentException- if the expected size is negativejava.lang.AssertionError- if the actualTableisnull.java.lang.AssertionError- if the actualTabledoes not have the expected column size.
-
hasSize
public TableAssert<R,C,V> hasSize(int expectedSize)
Verifies that the actualTablehas the expected number of cells.Example :
Table<Integer, Integer, String> actual = HashBasedTable.create(); actual.put(1, 3, "Millard Fillmore"); actual.put(1, 4, "Franklin Pierce"); actual.put(2, 5, "Grover Cleveland"); assertThat(actual).hasSize(3);- Parameters:
expectedSize- The columns to look for in the actualTable- Returns:
- this
TableAssertfor assertion chaining. - Throws:
java.lang.IllegalArgumentException- if the expected size is negativejava.lang.AssertionError- if the actualTableisnull.java.lang.AssertionError- if the actualTabledoes not have the expected number of cells.
-
containsRows
public TableAssert<R,C,V> containsRows(R... rows)
Verifies that the actualTablecontains the given rows.Example :
Table<Integer, Integer, String> actual = 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);- Parameters:
rows- The columns to look for in the actualTable- Returns:
- this
TableAssertfor assertion chaining. - Throws:
java.lang.IllegalArgumentException- if no param rows have been set.java.lang.AssertionError- if the actualTableisnull.java.lang.AssertionError- if the actualTabledoes not contain the given rows.
-
containsColumns
public TableAssert<R,C,V> containsColumns(C... columns)
Verifies that the actualTablecontains the given columns.Example :
Table<Integer, Integer, String> actual = 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);- Parameters:
columns- The columns to look for in the actualTable- Returns:
- this
TableAssertfor assertion chaining. - Throws:
java.lang.IllegalArgumentException- if no param columns have been set.java.lang.AssertionError- if the actualTableisnull.java.lang.AssertionError- if the actualTabledoes not contain the given columns.
-
containsValues
public TableAssert<R,C,V> containsValues(V... values)
Verifies that the actualTablecontains the given values for any key.Example :
Table<Integer, Integer, String> actual = 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");- Parameters:
values- The values to look for in the actualTable- Returns:
- this
TableAssertfor assertion chaining. - Throws:
java.lang.IllegalArgumentException- if no param values have been set.java.lang.AssertionError- if the actualTableisnull.java.lang.AssertionError- if the actualTabledoes not contain the given values.
-
containsCell
public TableAssert<R,C,V> containsCell(R row, C column, V expectedValue)
Verifies that the actualTablecontains the mapping of row/column to value.Example :
Table<Integer, Integer, String> actual = 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");- Parameters:
row- The row key to lookup in the actualTablecolumn- The column key to lookup in the actualTableexpectedValue- The value to look for in the actualTable- Returns:
- this
TableAssertfor assertion chaining. - Throws:
java.lang.AssertionError- if the actualTableisnull.java.lang.AssertionError- if the row key isnull.java.lang.AssertionError- if the column key isnull.java.lang.AssertionError- if the expected value isnull.
-
isEmpty
public void isEmpty()
Verifies that the actualTableis empty.Example :
Table<Integer, Integer, String> actual = HashBasedTable.create(); assertThat(actual).isEmpty();- Throws:
java.lang.AssertionError- if the actualTableisnull.java.lang.AssertionError- if the actualTableis not empty.
-
isNotEmpty
public TableAssert<R,C,V> isNotEmpty()
Verifies that the actualTableis not empty.Example :
Table<Integer, Integer, String> actual = HashBasedTable.create(); actual.put(1, 3, "Millard Fillmore"); assertThat(actual).isNotEmpty();- Returns:
- this
TableAssertfor assertion chaining. - Throws:
java.lang.AssertionError- if the actualTableisnull.java.lang.AssertionError- if the actualTableis empty.- Since:
- 3.27.0
-
checkExpectedSizeArgument
private void checkExpectedSizeArgument(int expectedSize)
-
-