~/talk

AssertJ Like a Pro

TalkinFrenchat Devoxx France 2024 · 2024-04-17..04-19· [testing]
links:none on file
slides:none on file

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

  1. 0:00Introduction
  2. 1:24Why use AssertJ
  3. 2:27Collection assertions
  4. 3:33Soft assertions and stack traces
  5. 4:36Temporal assertions
  6. 5:40Validator tests
  7. 6:42Conditions and reuse
  8. 8:48Custom assertions
  9. 11:15Tips and conclusion
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.