AssertJ Like a Pro
summary
Shows how using AssertJ instead of plain JUnit improves tests by providing clearer failure messages, collection helpers (first/last/hasOnlyOneElement), extraction by path or lambda, and temporal assertions (isAfter/isBefore/isBetween) with configurable windows. Demonstrates soft assertions, the JUnit 5 extension, and how to create a custom assertion class (extending AbstractAssert with a factory) to replace long validator blocks with concise three-line assertions that improve IDE autocompletion and readability.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 1:24Why use AssertJ
- 2:27Collection assertions
- 3:33Soft assertions and stack traces
- 4:36Temporal assertions
- 5:40Validator tests
- 6:42Conditions and reuse
- 8:48Custom assertions
- 11:15Tips and conclusion








