Exercise: Configure AssertJ-DB

After you have finished this exercise, you understand how you can configure AssertJ-DB. You can finish this exercise by following these steps:

1. Clone the Git repository that contains the sample applications of this course. If you have already cloned that repository, you can ignore this step.

2. Open the project found from the introduction-to-assertj-db/getting-started-with-assertj-db/introduction-to-assertj-db directory with your favorite IDE.

3. Open the TodoItemTableTest class that’s found from the com.cleantestautomation.assertjdb.todoitem package.

4. Configure AssertJ-DB. Make sure that you can write assertions for the data that’s found from the todo_item table.

5. Add the following static import to the TodoItemTableTest class:

import static org.assertj.db.api.Assertions.assertThat;

6. Add the following test method to the TodoItemTableTest class:

@DisplayName("The todo_item table should have no rows")
void shouldHaveNoRows() {
This step assumes that the name of the field which contains a reference to the Table object is: todoItemTable. If you used a different name, you have to replace the current field name with the correct one.

6. Run the test found from the TodoItemTableTest class and make sure that it passes.