I am working on a Java project where I have an ant build that runs JUnit tests that are controlled by Cobertura. This works great, and we kept our lighting very high. For some classes, such as Hibernate objects, we have minimal code in them, but they have equals and hashCode methods. Testing these issues is a huge pain and draws a percentage of coverage. We tried to use the EqualsVerifier . Two classes have references to each other, which are often found in Hibernate objects.
We looked at using Commons EqualsBuilder, but then we lose the ability to generate self-generated IDE equals / hashCode methods. I know that EqualsBuilder can also be executed using reflection, but we don’t want to lose performance at runtime just to cover unit test time.
The ideal situation would be if we could tell Cobertura to simply ignore the equals and hashCode methods, but the patches there require us to annotate our classes, which seems a bit inconvenient.
So, I hope for ideas from others regarding what works well in such cases. Does anyone have any ideas on how to do this?
Thanks!
source share