From your comments on the other answers, I do not understand what you want.
Just for discussion, let's say the class overrides the equals method.
So your UT will look something like this:
SomeType expected = // bla SomeType actual = // bli Assert.assertEquals(expected, actual).
And you're done. Moreover, you cannot get a “full picture of equality” if the statement is not fulfilled.
From what I understand, you say that even if the type made the redefinition equal, you would not be interested in this because you want to get a "picture of complete equality". Thus, there is no point in spreading and redefining peers.
So, you have options: either compare the property by property, using reflection or hard-coded checks, I would suggest the latter. Or: compare human readable representations of these objects.
For example, you can create a helper class that serializes the type you want to map to an XML document and compare the resulting XML! in this case, you can visually see what exactly is and what is not.
This approach will give you the opportunity to take a look at the big picture, but it is also relatively cumbersome (and a small mistake is prone at first).
Vitaliy Aug 27 '12 at 19:28 2012-08-27 19:28
source share