Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
import org.junit.jupiter.api.*;
 
@DisplayName("JUnit 5 Example")
class JUnit5ExampleTest {
 
    @BeforeAll
    static void beforeAll() {
        System.out.println("Before all test methods");
//        Some examples of common expensive operations are:
//       - the creation of a database connection
//       - the startup of a server.     }
 
    @BeforeEach
    void beforeEach() {
        System.out.println("Before each test method");
//        This is useful when we want to execute some common code before running a test.
//        - list initialization
     }
 
    @AfterEach
    void afterEach() {
        System.out.println("After each test method");
    }
 
    @AfterAll
    static void afterAll() {
        System.out.println("After all test methods");
    }
}

...