Add beforeeach module: @BeforeEach/@AfterEach lifecycle demos on JUnit 6.1.3 (JDK 25)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b6FRR2Dk1163xJ5CdV
This commit is contained in:
2026-11-15 01:14:28 +05:30
co-authored by Claude Sonnet 5.5
parent bfc67986bc
commit e49be6d633
36 changed files with 690 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
# JUnit @BeforeEach / @AfterEach demonstration
Runnable companion to the ankurm.com article
[JUnit @BeforeEach and @AfterEach](https://ankurm.com/junit-beforeeach-aftereach-complete-lifecycle-guide/).
`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.