I'm just curious about the workings of the
JUnit AssertEquals method when comparing two of my own classes where I have overridden the equals method and I was trying to work out why my
unit test for it kept failing. My example is as follows:
I thought that the AssertEquals method should just be using the equals method and the implementation in my classes would be called. However, in the above example, the assertTrue passes, but the AssertEquals fails. Debugging the assertEquals call, it never actually calls into my equals method.
Is there something wrong with my understanding of what's going on here?Am I likely to have missed something that might catch me out later?Is it generally better to avoid using AssertEquals for Object? Thanks for any thoughts you might have on this.
[ July 29, 2007: Message edited by: Stephen Masters ]
[ July 29, 2007: Message edited by: Stephen Masters ]