Tests may have a different idea (than the SUT) of what constitutes equality of two objects. In fact, it may be different from one test to another. It is not advisable to modify the definition of equality within the system under test (SUT) to match the tests' expectations as this leads to Equality Pollution. Doing individual Equality Assertions on many attributes of an object is not the answer either as it can result in Obscure Test and Test Code Duplication. Instead, build one or more Custom Assertions that meets your tests' needs.
Copyright © 2003-2008 Gerard Meszaros all rights reserved