In this chapter, we introduced the basics of the brand-new programming model of the JUnit 5 framework, known as Jupiter. This programming model provides a rich API that can be used by practitioners to create test cases. The most basic element of Jupiter is the annotation @Test, which identifies the methods in Java classes treated as tests (that is logic which exercises and verifies a SUT). Moreover, there are different annotations that can be used to control the test life cycle, namely, @BeforeAll, @BeforeEach, @AfterEach , and @AfterAll. Other useful Jupiter annotations are @Disabled (to skip tests), @DisplayName (to provide a test name), @Tag (to label and filter tests).
Jupiter provides a rich set of assertions, which are static methods in the class Assertions used to verify if the outcome obtained from the SUT corresponds with some expected value. We...