commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 17987] - Subclassing and EqualsBuilder is broken
Date Fri, 14 Mar 2003 18:07:09 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17987>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17987

Subclassing and EqualsBuilder is broken





------- Additional Comments From ggregory@seagullsw.com  2003-03-14 18:07 -------
Thank you for your thoughts, making good unit tests is key! Perhaps better 
comments would help of course... ;-)

The reasons I implemented asserting equivalence relationships all in the one 
method testReflectionEqualsEquivalenceRelationship is to allow for the whole 
equals contract to be validated at once. If the method where broken up in its 
component tests (reflection, symetry, transitivity, and sanity checks), it 
would be possible for tests case methods to be written that only assert a 
portion of the equals contract. IOW, this is a case where refactoring could 
introduce some bugs in the future. In your example style, I would have to 
remember to write all of the testSubclassingIsXXX methods for a given object 
fixture in order to assert the contract. 

The test case methods can be written to call 
testReflectionEqualsEquivalenceRelationship and be named for what they kind of 
objects tree they test. So the test case writer can dream up some nasty object 
tree and create a test case for it. For this test case, you can consider that 
the focus is on writing test fixtures rather than new equals contract 
assertions.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message