Closed GoogleCodeExporter closed 9 years ago
Should be a simple fix of
return o2 == null || o2.equals(o1);
and probably a similar fix below for the reverse case.
Original comment by dharkn...@gmail.com
on 30 Aug 2011 at 11:21
I'm confused. You want to test that the equals() method on your object can
handle null?
If so, should the test be
assertFalse(object.equals(null))
?
Original comment by smgfree...@gmail.com
on 25 Apr 2012 at 11:20
Original comment by t.denley
on 12 May 2012 at 10:30
I've been having a look at the Hamcrest code, and I can't see how you are
getting this. In fact, there is a unit test that proves the behaviour is not
as you describe:
public void testHonoursIsEqualImplementationEvenWithNullValues() {
Object alwaysEqual = new Object() {
@Override
public boolean equals(Object obj) {
return true;
}
};
Object neverEqual = new Object() {
@Override
public boolean equals(Object obj) {
return false;
}
};
assertThat(alwaysEqual, equalTo(null));
assertThat(neverEqual, not(equalTo(null)));
}
I can only conclude, therefore, that you are using a different version of
Hamcrest. Please can you confirm which version you are using, and re-test your
code against Hamcrest the 1.3RC2 jars.
Thanks,
-T
Original comment by t.denley
on 20 May 2012 at 11:14
closing, presumed fixed.
Original comment by t.denley
on 18 Jul 2012 at 4:07
Original issue reported on code.google.com by
o...@off-topic.biz
on 11 Aug 2011 at 7:38