bean-mapping: Dozer 7.0.0 vs MapStruct 1.6.3 module (basic/nested/collection/null handling, silent-failure pitfalls, records, lazy getters, parity test, compile-failure demos, JMH benchmark), 14 contract tests

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b6ZEVHGaYy15HAxRzy
This commit is contained in:
Ankur
2026-12-01 08:19:12 +05:30
co-authored by Claude Sonnet 5.5
parent a714780bca
commit 91f0757259
40 changed files with 2529 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
== 1. Basic + nested + collection in one mapper
UserEntity[id=1, username=ankurm, [email protected], profile=ProfileEntity[John Doe], tags=[Tag[Java], Tag[Spring Boot], Tag[Dozer], Tag[MapStruct], Tag[JMH]]]
== 2. Bidirectional through @InheritInverseConfiguration
round trip equals original: true
== 3. Null handling: the plain method copies null, the update method with IGNORE does not
new object from DTO with nulls: emailAddress=null, profile=null
update() of an existing entity: [email protected], profile=ProfileEntity[John Doe]
== 4. Records, both directions
record destination: UserRecord[id=1, username=ankurm]
record source: UserDTO[id=7, username=rec, email=null, profile=null, tags=[]]
== 5. A lazy getter: MapStruct calls it too, unless you ignore the property
map failed: IllegalStateException: could not initialize proxy - no Session (simulated lazy collection)
without ignore, getOrders() was called 1 time(s)
with ignore: LazyUserView[id=6, name=lazy2, orders=null], getOrders() called 0 time(s)