T
- The "self" type of this assertion class. Please read "Emulating 'self types' using Java Generics to simplify fluent API implementation"
for more details.public interface AssertOnColumnType<T extends AssertOnColumnType<T>>
The different type of values are enumerated in ValueType
.
Modifier and Type | Method and Description |
---|---|
T |
isBoolean(boolean lenient)
Verifies that the type of the values of the column is boolean.
|
T |
isBytes(boolean lenient)
Verifies that the type of the values of the column is array of bytes.
|
T |
isDate(boolean lenient)
Verifies that the type of the values of the column is date.
|
T |
isDateTime(boolean lenient)
Verifies that the type of the values of the column is date/time.
|
T |
isNumber(boolean lenient)
Verifies that the type of the values of the column is number.
|
T |
isOfAnyTypeIn(ValueType... expected)
Verifies that the type of the column is equal to one of the types in parameters.
|
T |
isOfType(ValueType expected,
boolean lenient)
Verifies that the type of the values of the column is equal to the type in parameter.
|
T |
isText(boolean lenient)
Verifies that the type of the values of the column is text.
|
T |
isTime(boolean lenient)
Verifies that the type of the values of the column is time.
|
T |
isUUID(boolean lenient)
Verifies that the type of the values of the column is UUID.
|
T 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);
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.AssertionError
- If the type of the column is different to the type in parameter.AbstractColumnAssert.isOfType(org.assertj.db.type.ValueType, boolean)
,
ChangeColumnAssert.isOfType(org.assertj.db.type.ValueType, boolean)
T 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);
expected
- The expected types to compare to.this
assertion object.AssertionError
- If the type of the column is different to all the types in parameters.AbstractColumnAssert.isOfAnyTypeIn(org.assertj.db.type.ValueType...)
,
ChangeColumnAssert.isOfAnyTypeIn(org.assertj.db.type.ValueType...)
T 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);
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.AssertionError
- If the type of the column is not number.ValueType.NUMBER
,
AbstractColumnAssert.isNumber(boolean)
,
ChangeColumnAssert.isNumber(boolean)
T 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);
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.AssertionError
- If the type of the column is not boolean.ValueType.BOOLEAN
,
AbstractColumnAssert.isBoolean(boolean)
,
ChangeColumnAssert.isBoolean(boolean)
T 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);
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.AssertionError
- If the type of the column is not date.ValueType.DATE
,
AbstractColumnAssert.isDate(boolean)
,
ChangeColumnAssert.isDate(boolean)
T 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);
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.AssertionError
- If the type of the column is not time.ValueType.TIME
,
AbstractColumnAssert.isTime(boolean)
,
ChangeColumnAssert.isTime(boolean)
T 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);
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.AssertionError
- If the type of the column is not date/time.ValueType.DATE_TIME
,
AbstractColumnAssert.isDateTime(boolean)
,
ChangeColumnAssert.isDateTime(boolean)
T 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);
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.AssertionError
- If the type of the column is not array of bytes.ValueType.BYTES
,
AbstractColumnAssert.isBytes(boolean)
,
ChangeColumnAssert.isBytes(boolean)
T 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);
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.AssertionError
- If the type of the column is not text.ValueType.TEXT
,
AbstractColumnAssert.isText(boolean)
,
ChangeColumnAssert.isText(boolean)
T isUUID(boolean lenient)
Example where the assertion verifies that all the values in the Column
called "id"
of the Table
is UUID :
assertThat(table).column("id").isUUID(false);
This assertion method is equivalent to :
xxxxx.isOfType(ValueType.UUID, lenient);
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.AssertionError
- If the type of the column is not UUID.ValueType.UUID
,
AbstractColumnAssert.isUUID(boolean)
,
ChangeColumnAssert.isUUID(boolean)
Copyright © 2020 AssertJ. All rights reserved.