V - The class of a assertion on a value (an sub-class of ValueElement).public interface ToValue<V extends ValueElement> extends Navigation
The different methods return an assertion on one value ValueElement.
These methods exists when navigating (at the beginning assertThat()) from changes, from a Table or from a Request.
As shown in the diagram below, if navigating from table or request, it is possible to call the method to navigate to a ValueElement from :
AbstractColumnAssert)AbstractColumnValueAssert)AbstractRowAssert)AbstractRowValueAssert)
If navigating from table or request, it is important to keep in mind that the methods are executed from the point of view of the last instance with assertion methods on a column (AbstractColumnAssert) or on a row (AbstractRowAssert).
So all the lines of code below are equivalent : they point on the value at index 1 (as usual, the list start at index 0) of first column.
assertThat(table_or_request).column().value(1)......; // Point directly on the value at index 1
assertThat(table_or_request).column().value().returnToColumn().value()......; // Use the returnToColumn() method to return to origin
// to return on the column and access to the next/second value of the list
assertThat(table_or_request).column().value().value()......; // Same as precedent but returnToColumn() is implicit
assertThat(table_or_request).column().value().value(1)......; // The method with the index can be call too
assertThat(table_or_request).column().value(2).value(0).value(1)......; // Idem
assertThat(table_or_request).column().value().column().value(1)......;
// Equivalent to the precedent but with the use of the methods to return to origin
assertThat(table).column().value().returnToColumn().returnToTable().column().value(1)......;
assertThat(request).column().value().returnToColumn().returnToRequest().column().value(1)......;
As shown in the diagram below, if navigating from changes, it is possible to call the method to navigate to a ValueElement from :
ChangeRowAssert)ChangeRowValueAssert)
If navigating from changes, it is important to keep in mind that the methods are executed from the point of view of the last instance with assertion methods on a row of a change (ChangeRowAssert).
So all the lines of code below are equivalent : they point on the value at index 1 (as usual, the list start at index 0) of first row.
assertThat(changes).change().row().value(1)......; // Point directly on the value at index 1
// Use the returnToRow() method return on the row and access to the next/second value of the list
assertThat(changes).change().row().value().returnToRow().value()......;
assertThat(changes).change().row().value().value()......; // Same as precedent but returnToRow() is implicit
assertThat(changes).change().row().value().value(1)......; // The method with the index can be call too
assertThat(changes).change().row().value(2).value(0).value(1)......; // Idem
assertThat(changes).change().row().value().change(0).row().value(1)......;
// Equivalent to the precedent but with the use of the methods to return to origin
assertThat(changes).change().row().value().returnToRow().returnToChange().returnToChanges().change(0).row().value(1)......;
| Modifier and Type | Method and Description |
|---|---|
V |
value()
Returns assertion methods on the next value in the list of values.
|
V |
value(int index)
Returns assertion methods on the value at the
index in parameter. |
V value()
AssertJDBException - If there are no more value in the list of values.AbstractSubAssert.value(),
AbstractValueAssert.value(),
AbstractSubAssert.value(),
AbstractValueAssert.value(),
ChangeRowAssert.value(),
ChangeRowValueAssert.value()V value(int index)
index in parameter.index - The index corresponding to the value.AssertJDBException - If the index is out of the bounds.AbstractSubAssert.value(int),
AbstractValueAssert.value(int),
AbstractSubAssert.value(int),
AbstractValueAssert.value(int),
ChangeRowAssert.value(int),
ChangeRowValueAssert.value(int)Copyright © 2020 AssertJ. All rights reserved.