JUnit 5's Best Features
summary
JUnit 5 runs legacy JUnit 4/3 tests via the Vintage engine, uses a Platform + Jupiter split, and lets tests choose per-class test instance lifecycle so @BeforeAll can be nonstatic. Assertions include assertAll runs all assertions and assertThrows/assertTimeout (with preemptive cancellation); messages are lazily supplied. Assumptions act as precondition checks. Parameterized tests support method/enum/CSV and a parameterized CSV file source with custom aggregators. Platform supports conditional OS/JRE/env guards, parallel execution via junit-platform.properties, and built-in Spring/Mockito extensions.
AI-written summary · about
chapters (13)
- 0:00Introduction to JUnit 5
- 1:50Legacy test compatibility
- 8:13JUnit 5 architecture
- 9:39Test lifecycle changes
- 12:09Custom test display names
- 13:34Assertion improvements
- 23:52Lazy error message evaluation
- 29:05Assumptions in tests
- 33:42Conditional test execution
- 39:04Test ordering control
- 41:12Parameterized tests
- 51:02Parallel test execution
- 53:08Conclusion and resources
