I created an extension to the EqualsHashCodeTestCase that uses reflections to test equality for all attributes in a POJO. It's used in exactly the same way as EqualsHashCodeTestCase.
This is what it does:
1) assert equalObj1.equals(equalObj2) and !equalObj1.equals(differentObj)
2) for all attributes in the class not annotated by ExcludeFromEquals
3a) change the attributes' value the value...
An exception occurs when attempting to create message with these expected ant actual values :
Expected:
key2=value2_blabla
Actual:
key2=value2
java.lang.StringIndexOutOfBoundsException: String index out of range: 11
at java.lang.String.charAt(String.java:687)
at junitx.framework.ComparisonFailure.createMessage(ComparisonFailure.java:145)
at...