After you have finished this exercise, you understand how you can emphasize a business rule by writing soft assertions with AssertJ-DB. Let’s assume that you have to write an integration test which ensures that the system under test inserts an open todo item into the todo_item
table. An open todo item must fulfill these two conditions:
- Its status (the value of the
status
column) must beTodoItemStatus.OPEN
- Its resolution (the value of the
resolution
column) must benull
.
You can finish this exercise by following these steps:
1. Open the CreateTodoItemTest
class that’s found from the com.cleantestautomation.assertjdb.todoitem
package.
2. Write the soft assertions which ensure that the system under test inserts an open todo item into the todo_item
table. You have to add these soft assertions to the shouldInsertOpenTodoItemIntoDatabase()
method.
3. Run the tests found from the CreateTodoItemTest
class and make sure that they pass.