Files

1.9 KiB

assertj

Companion code for the ankurm.com post AssertJ Complete Guide: Soft Assertions, Recursive Comparison and Custom Assertions.

Component Version
AssertJ Core 3.27.7 (GA, 2026-01-24; 4.0.0-M1 also exists on Maven Central but is a milestone)
JUnit 6.1.3
assertj-assertions-generator-maven-plugin 2.2.0 (last release, 2019)
JDK 25 (Temurin 25.0.5+8)
./scripts/run-all.sh      # runs every test and regenerates output/*.txt

Each test writes a transcript to output/ and asserts the same facts, so every message quoted in the post fails the build if it stops being true. Two things in the output are not stable between runs: Customer@<hash> identity hashes in 14-isEqualTo-without-equals.txt.

Test Output files Topic
BasicAssertionsTest 01-04 failure messages, forgotten terminal call, BigDecimal and double
CollectionAssertionsTest 05-08 contains family, extracting, tuples, allSatisfy, maps
ExceptionAssertionsTest 09 assertThatThrownBy, cause chain, wrong-message output
SoftAssertionsTest 10-13 hard vs soft, forgotten assertAll(), NPE after a soft failure, JUnit extension
RecursiveComparisonTest 14-17 no-equals problem, DTO vs entity, difference report, ignoring and comparators
CustomAssertionsTest 18-19 hand-written InvoiceAssert, Condition
GeneratedAssertionsTest 20-24 generated OrderAssert, generated soft entry point, javax.annotation failure
scripts/capture-generator.sh 22-25 generator file list, javax.annotation compile error, the same tests on 4.0.0-M1

The pom.xml runs assertj-assertions-generator-maven-plugin on lab.assertj.domain before tests compile. It still emits @javax.annotation.Generated, so javax.annotation-api is a test dependency; scripts/capture-generator.sh removes it in a scratch copy to record the compiler error.