-
The latest version of equalsverifier complains that our class that extends
It seems to me that adding
In assertTrue(
Formatter.of(message, fieldName),
!fieldShouldBeIgnored ||
!equalsChanged ||
skipCertainTestsThatDontMatterWhenValuesAreNull
); I'm wondering if the code should read |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
EqualsVerifier has recently become a bit more rigorous when it comes to JPA entities. There's a debate on whether it's better to give entities a business key (aka natural key), or a surrogate key. A business key is when all the semantically meaningful fields are part of the object's identity and assumes that the key is just there for technical reasons and doesn't actually mean anything for the user. A surrogate key is when the object's identity relies exclusively on the key, and the actual content of the fields doesn't matter. EqualsVerifier assumes a business key by default, which means that you can't use If your class has a business key but the You can read more about it in the manual: https://jqno.nl/equalsverifier/manual/jpa-entities/
|
Beta Was this translation helpful? Give feedback.
EqualsVerifier has recently become a bit more rigorous when it comes to JPA entities. There's a debate on whether it's better to give entities a business key (aka natural key), or a surrogate key. A business key is when all the semantically meaningful fields are part of the object's identity and assumes that the key is just there for technical reasons and doesn't actually mean anything for the user. A surrogate key is when the object's identity relies exclusively on the key, and the actual content of the fields doesn't matter.
EqualsVerifier assumes a business key by default, which means that you can't use
id
inequals
. If you want EqualsVerifier to assume a surrogate key, you can suppress…