Should one override equals method for asserting the object equality in a unit test? -
Suppose we are examining the results of a method by emphasizing the similarity of all the properties of the results, the expected results Object should apply equally to us and use the apprehension. Recyclable (expected result, actual resource) ... but the equivalent means something different in the output code.
Which is the best practice?
- Emphasizing the similarity of objects through overrides
or
- Emphasizing the similarity of all the properties
- Do not bind test-related problems, it means that in the test method, the meaning of
equal
can not match the meaning of the output code; - It may not be enough for all the tests that may be different. Different tests will require different arguments, so you can probably use custom claims.
I have two main reasons for using a custom practices:
Comments
Post a Comment