Is there a Java reflection utility to do a deep comparison of two objects?

Uri picture Uri · Sep 19, 2009 · Viewed 81.9k times · Source

I'm trying to write unit tests for a variety of clone() operations inside a large project and I'm wondering if there is an existing class somewhere that is capable of taking two objects of the same type, doing a deep comparison, and saying if they're identical or not?

Answer

Wolfgang picture Wolfgang · Sep 19, 2009

Unitils has this functionality:

Equality assertion through reflection, with different options like ignoring Java default/null values and ignoring order of collections