From: Nat P. <nat...@b1...> - 2003-06-02 22:16:54
|
According to the Java equals protocol, the expressions arg.equals(_object) and _object.equals(arg) must act the same, so it makes no difference. If the two expressions act differently, then that is a bug in the implementation of the class of arg or _object. Cheers, Nat. _______________________ Dr. Nathaniel Pryce B13media Ltd. http://www.b13media.com +44 (0)7712 526 661 ----- Original Message ----- From: "Vincent Tence" <Vin...@ge...> To: "'Mockobjects-Java-Dev'" <moc...@li...> Sent: Monday, June 02, 2003 10:57 PM Subject: [MO-java-dev] Is IsEqual testing for equality in the right order? > Hi, > > I noticed that the IsEqual constraint tests for equality by comparing the > expected value against the actual value. IIRC it used to be the other way > around with "static" mocks - i.e. expected.equals(actual) - so you could > deal with legacy code not implementing equals correctly. It has helped me in > a number of situtations. Any reason why this has changed? > > Extract from IsEqual : > > public boolean eval( Object arg ) { > if(arg instanceof Object[]) { > arg = Arrays.asList((Object[])arg); > } > return arg.equals(_object); > } > > It could be _object.equals(arg) or am I missing something? > > Thanks, > Vincent > > > > ------------------------------------------------------- > This SF.net email is sponsored by: eBay > Get office equipment for less on eBay! > http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev |