public final class BDDAssertions extends Object
The difference with the Assertions class is that the entry point methods are named then
instead of assertThat.
The navigation methods are defined in navigation package.
The assertion methods are defined in assertions package.
Example with a Source and a Table with test on the content on the first row of the movie
table that the title column contains "Alien" as text and the next column contains 1979 as a number :
Source source = new Source("jdbc:h2:mem:test", "sa", "");
Table table = new Table(source, "movie");
then(table)
.row()
.value("title")
.isEqualTo("Alien")
.returnToRow()
.value()
.isEqualTo(1979);
It is possible to chain assertion on a value :
then(table)
.row()
.value("title")
.isText()
.isEqualTo("Alien");
It is not necessary to use the returnToXxxx methods. The next example is equivalent to the first :
Source source = new Source("jdbc:h2:mem:test", "sa", "");
Table table = new Table(source, "movie");
then(table)
.row()
.value("title")
.isEqualTo("Alien")
.value()
.isEqualTo(1979);
It is possible to do the same thing with column and the row :
then(table)
.row()
.value("title")
.isEqualTo("Alien")
.row()
.value()
.isEqualTo("The Village")
.column("year")
.value(1)
.equalTo(2004);
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
bytesContentFromClassPathOf(String resource)
Reads the bytes from a file in the classpath and returns them.
|
static byte[] |
bytesContentOf(File file)
Reads the bytes from a file and returns them.
|
static ChangesAssert |
then(Changes changes)
Creates a new instance of
ChangesAssert. |
static RequestAssert |
then(Request request)
Creates a new instance of
RequestAssert. |
static TableAssert |
then(Table table)
Creates a new instance of
TableAssert. |
public static TableAssert then(Table table)
TableAssert.table - The table to assert on.public static RequestAssert then(Request request)
RequestAssert.request - The request to assert on.public static ChangesAssert then(Changes changes)
ChangesAssert.changes - The changes to assert on.public static byte[] bytesContentOf(File file)
file - The FileNullPointerException - If the file field is null.AssertJDBException - If triggered, this exception wrap a possible IOException during the loading.public static byte[] bytesContentFromClassPathOf(String resource)
resource - The name of the file in the classpath.NullPointerException - If the resource field is null.Copyright © 2015–2017 AssertJ. All rights reserved.