Files

JUnit @BeforeEach / @AfterEach demonstration

Runnable companion to the ankurm.com article JUnit @BeforeEach and @AfterEach.

Fixtures.java holds one small test class per scenario. LifecycleOrderTest runs each of them through the real JUnit Launcher, asserts what happened and writes the event log to output/, so every transcript quoted in the article is also an assertion that fails the build when it stops being true. Everything else (explanations, diagrams, the downloadable real-world examples) lives in the article itself; this module has no separate docs.

Run: mvn test (JDK 17+). Same suite on JUnit 5: mvn test -Djunit.version=5.14.4.

Versions: JUnit 6.1.3 by default, run on JDK 25. Surefire 3.5.4.