After you have finished this exercise, you understand how you can use custom assertion methods when you have to write 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 and row level assertions which ensure that the system under test doesn’t make any changes to the data that’s found from the todo_item
table when the deleted todo item isn’t found from the database. You have to add these assertions to the test methods found from the WhenDeletedTodoItemIsNotFound
class. Remember to use the custom assertion methods which you wrote during the exercise 2.
3. Write the table level assertion which ensures that system under test deletes one todo item 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 of the WhenDeletedTodoItemIsFound
class.
4. Write the row level assertions which ensure that the system under test doesn’t make any changes to the information of the ‘Read all lessons’ todo item when the deleted todo item is found from the database. You have to add these assertions to the shouldNotMakeAnyChangesToInformationOfReadAllLessonsTodoItem()
method that’s found from the WhenDeletedTodoItemIsFound
class. Use the custom assertion method which you wrote during the exercise 2.
5. Run the tests found from the DeleteTodoItemTest
class and make sure that they pass.