Automate setup and cleanup using BeforeEachCallback and AfterEachCallback in JUnit
Preconditions (2)
Step 1: Create a class that implements BeforeEachCallback and AfterEachCallback interfaces
Step 2: In the beforeEach method, add code to print 'Setup before each test'
Step 3: In the afterEach method, add code to print 'Cleanup after each test'
Step 4: Register this callback class as an extension in the test class using @ExtendWith
Step 5: Write two simple test methods that assert basic conditions
Step 6: Run the tests and observe the console output for setup and cleanup messages before and after each test
✅ Expected Result: Each test method runs successfully, and console output shows 'Setup before each test' before each test and 'Cleanup after each test' after each test