D
- The class of the actual value (an sub-class of AbstractDbData
).A
- The class of the original assertion (an sub-class of AbstractDbAssert
).C
- The class of this assertion (an sub-class of AbstractColumnAssert
).CV
- The class of this assertion on the value (an sub-class of AbstractColumnValueAssert
).R
- The class of the equivalent row assertion (an sub-class of AbstractRowAssert
).RV
- The class of the equivalent row assertion on the value (an sub-class of AbstractRowValueAssert
).public abstract class AbstractColumnAssert<D extends AbstractDbData<D>,A extends AbstractDbAssert<D,A,C,CV,R,RV>,C extends AbstractColumnAssert<D,A,C,CV,R,RV>,CV extends AbstractColumnValueAssert<D,A,C,CV,R,RV>,R extends AbstractRowAssert<D,A,C,CV,R,RV>,RV extends AbstractRowValueAssert<D,A,C,CV,R,RV>> extends AbstractSubAssert<D,A,C,CV,C,CV,R,RV> implements ColumnAssert, AssertOnColumnEquality<C>, AssertOnNumberOfRows<C>, AssertOnColumnName<C>, AssertOnColumnType<C>, AssertOnColumnNullity<C>
Column
s assertions.origin
info, myself
Modifier and Type | Method and Description |
---|---|
protected CV |
getValueAssertInstance(Class<CV> valueAssertType,
int index,
Object value)
Gets an instance of value assert corresponding to the index and the value.
|
protected List<Object> |
getValuesList()
Returns the list of values.
|
C |
hasColumnName(String columnName)
Verifies that the name of a column is equal to the parameter.
|
C |
hasNumberOfRows(int expected)
Verifies that the number of rows is equal to the number in parameter.
|
C |
hasOnlyNotNullValues()
Verifies that all the values of the column are not
null . |
C |
hasOnlyNullValues()
Verifies that all the values of the column are
null . |
C |
hasValues(Boolean... expected)
Verifies that the values of a column are equal to booleans.
|
C |
hasValues(byte[]... expected)
Verifies that the values of a column are equal to bytes.
|
C |
hasValues(DateTimeValue... expected)
Verifies that the values of a column are equal to date/time values.
|
C |
hasValues(DateValue... expected)
Verifies that the values of a column are equal to date values.
|
C |
hasValues(Number... expected)
Verifies that the values of a column are equal to numbers.
|
C |
hasValues(String... expected)
Verifies that the values of a column are equal to texts.
|
C |
hasValues(TimeValue... expected)
Verifies that the values of a column are equal to time values.
|
C |
isBoolean(boolean lenient)
Verifies that the type of the values of the column is boolean.
|
C |
isBytes(boolean lenient)
Verifies that the type of the values of the column is array of bytes.
|
C |
isDate(boolean lenient)
Verifies that the type of the values of the column is date.
|
C |
isDateTime(boolean lenient)
Verifies that the type of the values of the column is date/time.
|
C |
isNumber(boolean lenient)
Verifies that the type of the values of the column is number.
|
C |
isOfAnyTypeIn(ValueType... expected)
Verifies that the type of the column is equal to one of the types in parameters.
|
C |
isOfType(ValueType expected,
boolean lenient)
Verifies that the type of the values of the column is equal to the type in parameter.
|
C |
isText(boolean lenient)
Verifies that the type of the values of the column is text.
|
C |
isTime(boolean lenient)
Verifies that the type of the values of the column is time.
|
getValue, getValueAssertInstance, value, value
column, column, column, row, row
returnToOrigin
as, as, describedAs, describedAs
protected CV getValueAssertInstance(Class<CV> valueAssertType, int index, Object value) throws Exception
getValueAssertInstance
in class AbstractSubAssert<D extends AbstractDbData<D>,A extends AbstractDbAssert<D,A,C,CV,R,RV>,C extends AbstractColumnAssert<D,A,C,CV,R,RV>,CV extends AbstractColumnValueAssert<D,A,C,CV,R,RV>,C extends AbstractColumnAssert<D,A,C,CV,R,RV>,CV extends AbstractColumnValueAssert<D,A,C,CV,R,RV>,R extends AbstractRowAssert<D,A,C,CV,R,RV>,RV extends AbstractRowValueAssert<D,A,C,CV,R,RV>>
valueAssertType
- Class of the assertion on the value : a sub-class of AbstractValueAssert
.index
- Index of the value on which is the instance of value assert.value
- Value on which is the instance of value assert.Exception
- Exception during the instantiation.protected List<Object> getValuesList()
getValuesList
in class AbstractSubAssert<D extends AbstractDbData<D>,A extends AbstractDbAssert<D,A,C,CV,R,RV>,C extends AbstractColumnAssert<D,A,C,CV,R,RV>,CV extends AbstractColumnValueAssert<D,A,C,CV,R,RV>,C extends AbstractColumnAssert<D,A,C,CV,R,RV>,CV extends AbstractColumnValueAssert<D,A,C,CV,R,RV>,R extends AbstractRowAssert<D,A,C,CV,R,RV>,RV extends AbstractRowValueAssert<D,A,C,CV,R,RV>>
public C hasNumberOfRows(int expected)
Example where the assertion verifies that the table has 2 rows :
assertThat(table).hasNumberOfRows(2);
Example where the assertion verifies that the column with index 1 of the table has 5 rows :
assertThat(table).column(1).hasNumberOfRows(5);
hasNumberOfRows
in interface AssertOnNumberOfRows<C extends AbstractColumnAssert<D,A,C,CV,R,RV>>
expected
- The number to compare to the number of rows.this
assertion object.AbstractDbAssert.hasNumberOfRows(int)
,
hasNumberOfRows(int)
public C isOfType(ValueType expected, boolean lenient)
Example where the assertion verifies that all the values in the Column
called "title" of the Table
is of type TEXT
:
assertThat(table).column("title").isOfType(ValueType.TEXT, false);
Example where the assertion verifies that all the values in the Column
called "title" of the Table
is of type TEXT
or not identified (for example null
) :
assertThat(table).column("title").isOfType(ValueType.TEXT, true);
isOfType
in interface AssertOnColumnType<C extends AbstractColumnAssert<D,A,C,CV,R,RV>>
expected
- The expected type to compare to.lenient
- true
if the test is lenient : if the type of a value is not identified (for example when the
value is null
), it consider that it is ok.this
assertion object.isOfType(org.assertj.db.type.ValueType, boolean)
public C isOfAnyTypeIn(ValueType... expected)
Example where the assertion verifies that the values in the Column
called "title" of the Table
is
of type TEXT
or of type NUMBER
:
assertThat(table).column("title").isOfAnyTypeIn(ValueType.TEXT, ValueType.NUMBER);
isOfAnyTypeIn
in interface AssertOnColumnType<C extends AbstractColumnAssert<D,A,C,CV,R,RV>>
expected
- The expected types to compare to.this
assertion object.isOfAnyTypeIn(org.assertj.db.type.ValueType...)
public C isNumber(boolean lenient)
Example where the assertion verifies that all the values in the Column
called "year"
of the Table
is a number :
assertThat(table).column("year").isNumber(true);
This assertion method is equivalent to :
xxxxx.isOfType(ValueType.NUMBER, lenient);
isNumber
in interface AssertOnColumnType<C extends AbstractColumnAssert<D,A,C,CV,R,RV>>
lenient
- true
if the test is lenient : if the type of a value is not identified (for example when the
value is null
), it consider that it is ok.this
assertion object.ValueType.NUMBER
,
isNumber(boolean)
public C isBoolean(boolean lenient)
Example where the assertion verifies that all the values in the first Column
of
the Table
is a boolean :
assertThat(table).column().isBoolean(false);
This assertion method is equivalent to :
xxxxx.isOfType(ValueType.BOOLEAN, lenient);
isBoolean
in interface AssertOnColumnType<C extends AbstractColumnAssert<D,A,C,CV,R,RV>>
lenient
- true
if the test is lenient : if the type of a value is not identified (for example when the
value is null
), it consider that it is ok.this
assertion object.ValueType.BOOLEAN
,
isBoolean(boolean)
public C isDate(boolean lenient)
Example where the assertion verifies that all the values in the Column
called "birth"
of the Table
is a date :
assertThat(table).column("birth").isDate(false);
This assertion method is equivalent to :
xxxxx.isOfType(ValueType.DATE, lenient);
isDate
in interface AssertOnColumnType<C extends AbstractColumnAssert<D,A,C,CV,R,RV>>
lenient
- true
if the test is lenient : if the type of a value is not identified (for example when the
value is null
), it consider that it is ok.this
assertion object.ValueType.DATE
,
isDate(boolean)
public C isTime(boolean lenient)
Example where the assertion verifies that all the values in the first Column
of
the Table
is a time :
assertThat(table).column().isTime(false);
This assertion method is equivalent to :
xxxxx.isOfType(ValueType.TIME, lenient);
isTime
in interface AssertOnColumnType<C extends AbstractColumnAssert<D,A,C,CV,R,RV>>
lenient
- true
if the test is lenient : if the type of a value is not identified (for example when the
value is null
), it consider that it is ok.this
assertion object.ValueType.TIME
,
isTime(boolean)
public C isDateTime(boolean lenient)
Example where the assertion verifies that all the values in the first Column
of
the Table
is a date/time :
assertThat(table).column().isDateTime(false);
This assertion method is equivalent to :
xxxxx.isOfType(ValueType.DATE_TIME, lenient);
isDateTime
in interface AssertOnColumnType<C extends AbstractColumnAssert<D,A,C,CV,R,RV>>
lenient
- true
if the test is lenient : if the type of a value is not identified (for example when the
value is null
), it consider that it is ok.this
assertion object.ValueType.DATE_TIME
,
isDateTime(boolean)
public C isBytes(boolean lenient)
Example where the assertion verifies that all the values in the first Column
of
the Table
is a array of bytes :
assertThat(table).column().isBytes(false);
This assertion method is equivalent to :
xxxxx.isOfType(ValueType.BYTES, lenient);
isBytes
in interface AssertOnColumnType<C extends AbstractColumnAssert<D,A,C,CV,R,RV>>
lenient
- true
if the test is lenient : if the type of a value is not identified (for example when the
value is null
), it consider that it is ok.this
assertion object.ValueType.BYTES
,
isBytes(boolean)
public C isText(boolean lenient)
Example where the assertion verifies that all the values in the Column
called "title"
of the Table
is a text :
assertThat(table).column("title").isText(false);
This assertion method is equivalent to :
xxxxx.isOfType(ValueType.TEXT, lenient);
isText
in interface AssertOnColumnType<C extends AbstractColumnAssert<D,A,C,CV,R,RV>>
lenient
- true
if the test is lenient : if the type of a value is not identified (for example when the
value is null
), it consider that it is ok.this
assertion object.ValueType.TEXT
,
isText(boolean)
public C hasOnlyNullValues()
null
.
Example where the assertion verifies that all the values in the first Column
of the Table
are
null
:
assertThat(table).column().hasOnlyNullValues();
hasOnlyNullValues
in interface AssertOnColumnNullity<C extends AbstractColumnAssert<D,A,C,CV,R,RV>>
this
assertion object.hasOnlyNullValues()
public C hasOnlyNotNullValues()
null
.
Example where the assertion verifies that all the values in the first Column
of the Table
are not
null
:
assertThat(table).column().hasOnlyNotNullValues();
hasOnlyNotNullValues
in interface AssertOnColumnNullity<C extends AbstractColumnAssert<D,A,C,CV,R,RV>>
this
assertion object.hasOnlyNotNullValues()
public C hasValues(Boolean... expected)
Example where the assertion verifies that the values in the first Column
of the Table
are equal to
the booleans in parameter :
assertThat(table).column().hasValues(true, false, true);
hasValues
in interface AssertOnColumnEquality<C extends AbstractColumnAssert<D,A,C,CV,R,RV>>
expected
- The expected boolean values.this
assertion object.hasValues(Boolean...)
public C hasValues(Number... expected)
Example where the assertion verifies that the values in the first Column
of the Table
are equal to
the numbers in parameter :
assertThat(table).column().hasValues(5, 10.5, 6);
hasValues
in interface AssertOnColumnEquality<C extends AbstractColumnAssert<D,A,C,CV,R,RV>>
expected
- The expected numbers values.this
assertion object.hasValues(Number...)
public C hasValues(byte[]... expected)
Example where the assertion verifies that the values in the first Column
of the Table
are equal to
arrays of bytes loaded from files in the classpath :
byte[] bytes1 = bytesContentFromClassPathOf("file1.png");
byte[] bytes2 = bytesContentFromClassPathOf("file2.png");
assertThat(table).column().hasValues(bytes1, bytes2);
hasValues
in interface AssertOnColumnEquality<C extends AbstractColumnAssert<D,A,C,CV,R,RV>>
expected
- The expected bytes values.this
assertion object.org.assertj.db.api.AbstractColumnAssert#hasValues(byte[]...)
public C hasValues(String... expected)
Example where the assertion verifies that the values in the first Column
of the Table
are equal to
the texts in parameter :
assertThat(table).column().hasValues("text", "text2", "text3");
hasValues
in interface AssertOnColumnEquality<C extends AbstractColumnAssert<D,A,C,CV,R,RV>>
expected
- The expected text values.this
assertion object.hasValues(String...)
public C hasValues(DateValue... expected)
Example where the assertion verifies that the values in the first Column
of the Table
are equal to
the date values in parameter :
assertThat(table).column().hasValues(DateValue.of(2014, 7, 7), DateValue.of(2014, 10, 3),
DateValue.of(2014, 12, 23));
hasValues
in interface AssertOnColumnEquality<C extends AbstractColumnAssert<D,A,C,CV,R,RV>>
expected
- The expected date values.this
assertion object.hasValues(DateValue...)
public C hasValues(TimeValue... expected)
Example where the assertion verifies that the values in the first Column
of the Table
are equal to
the time values in parameter :
assertThat(table).column().hasValues(TimeValue.of(21, 29, 30), TimeValue.of(10, 1, 25), TimeValue.of(9, 1));
hasValues
in interface AssertOnColumnEquality<C extends AbstractColumnAssert<D,A,C,CV,R,RV>>
expected
- The expected time values.this
assertion object.hasValues(TimeValue...)
public C hasValues(DateTimeValue... expected)
Example where the assertion verifies that the values in the first Column
of the Table
are equal to
the date/time values in parameter :
assertThat(table).column().hasValues(DateTimeValue.of(DateValue.of(2014, 7, 7), TimeValue.of(21, 29)),
DateTimeValue.of(DateValue.of(2014, 7, 7), TimeValue.of(10, 1, 25)),
DateTimeValue.of(DateValue.of(2014, 7, 7), TimeValue.of(9, 1)));
hasValues
in interface AssertOnColumnEquality<C extends AbstractColumnAssert<D,A,C,CV,R,RV>>
expected
- The expected date/time values.this
assertion object.hasValues(DateTimeValue...)
public C hasColumnName(String columnName)
Example where the assertion verifies that the column name of the first Column
of the Table
is equal to
"title" :
assertThat(table).column().hasColumnName("title");
Example where the assertion verifies that the first value of the first Row
of the Table
is equal to
"title" :
assertThat(table).row().value().hasColumnName("title");
Example where the assertion verifies that the column name of the first Column
of the Table
is equal to
"title" :
assertThat(changes).change(1).column().hasColumnName("title");
Example where the assertion verifies that the first value of the first Row
of the Table
is equal to
"title" :
assertThat(changes).change(1).row().value().hasColumnName("title");
hasColumnName
in interface AssertOnColumnName<C extends AbstractColumnAssert<D,A,C,CV,R,RV>>
columnName
- The expected column name.this
assertion object.hasColumnName(String)
,
AbstractRowValueAssert.hasColumnName(String)
,
ChangeColumnAssert.hasColumnName(String)
,
ChangeRowValueAssert.hasColumnName(String)
Copyright © 2015 AssertJ. All Rights Reserved.