Closed kulinskyvs closed 5 years ago
Thank you for reporting this issue, it has been fixed in version 1.4.5. If you have any further issues, please let me know.
1.4.5 should sync to maven central in a few hours, so it will be available soon.
Thank you for your really very fast reaction!
With latest version of ToStringVerifier (1.4.4) the verifications with Apache presets with switched "hashcode" (com.jparams.verifier.tostring.preset.Presets#APACHE_TO_STRING_BUILDER_NO_CLASS_NAME_STYLE and com.jparams.verifier.tostring.preset.Presets#APACHE_TO_STRING_BUILDER_DEFAULT_STYLE) are failing.
The code:
The test:
The result:
The reason - System.identityHashCode is used to transform the hash code into string on Apache side (see org.apache.commons.lang3.builder.ToStringStyle#appendIdentityHashCode), while Integer.toHexString is used for hash code verification on the library side (see com.jparams.verifier.tostring.ToStringVerifier#verifyHashCode).
A remark: I'm using apache commons version 3.7 (it can be a recent change in this version).