As we saw in Chapter 1, Retrospective on software quality and Java testing, a unit test case is composed of four stages:
- Setup (optional): First, the test initializes the test fixture (before the picture of the SUT).
- Exercise: Second, the test interacts with the SUT, getting some outcome from it as a result.
- Verify: Third, the outcome from the system under test is compared to the expected value using one or several assertions (also known as predicates). As a result, a test verdict is created.
- Teardown (optional): Finally, the test releases the test fixture to put the SUT back into the initial state.
In JUnit 4, there were different annotations to control these test phases. JUnit 5 follows the same approach, that is, Java ...