Exercise 3: Delete a Row From a Database Table

After you have finished this exercise, you understand how you can write the required table level assertions when you are writing integration tests for code that deletes a row from a database table. You can finish this exercise by following these steps:

1. Open the DeleteTodoItemTest class that’s found from the com.cleantestautomation.assertjdb.todoitem package.

2. Write the table level assertion which ensures that the system under test doesn’t delete a row from the todo_item table or insert a new row into the todo_item table when the deleted todo item isn’t found from the database. You have to add this assertion to the shouldNotDeleteTodoItemsFromDatabaseOrInsertNewTodoItemsIntoDatabase() method that’s found from the WhenDeletedTodoItemIsNotFound class.

3. Write the table level assertion which ensures that the system under test deletes one row from the todo_item table when the deleted todo item is found from the database. You have to add this assertion to the shouldDeleteOneTodoItemFromDatabase() method that’s found from the WhenDeletedTodoItemIsFound class.

4. Run the tests found from the DeleteTodoItemTest class and make sure that they pass.