|
From: <fra...@ya...> - 2002-03-28 16:32:31
|
Hello again !
I added tests in equality to assert that null objects are not equal to other
classes of objects. I tested against a string with the same value as the
null's description, and against java.lang.Integer. I guess that at least tests
the simple cases.
A question: If Null is subclassed, should the subclass still be equal to Null
? If I get directions on how you would want to process that, I'll write the
proper test case.
Thanks !
Francois Beausoleil
Index: TestNull.java
===================================================================
RCS file:
/cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/test/TestNull.java,v
retrieving revision 1.1
diff -u -r1.1 TestNull.java
--- TestNull.java 22 Feb 2002 10:28:44 -0000 1.1
+++ TestNull.java 28 Mar 2002 16:26:54 -0000
@@ -29,6 +29,10 @@
assertEquals("Should be same value", new Null("one"), new
Null("two"));
assertEquals("Should be same hashCode", new Null("one").hashCode(),
new Null("two").hashCode());
+
+ // Compare with other objects to assert that they are not equal
+ assertEquals("Not equal to something else", false, new
Null("one").equals("one"));
+ assertEquals("Not equal to something else", false, new
Null().equals(new Integer(2)));
}
public void testDescription() {
__________________________________________________________
Lèche-vitrine ou lèche-écran ?
magasinage.yahoo.ca
|