KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > mockobjects > TestNull


1 package test.mockobjects;
2
3 import junit.framework.Test;
4 import junit.framework.TestSuite;
5
6 import com.mockobjects.util.Null;
7 import com.mockobjects.util.TestCaseMo;
8
9 /**
10  * JUnit test case for TestMapEntry
11  */

12
13 public class TestNull extends TestCaseMo {
14
15     public TestNull(String JavaDoc name) {
16         super(name);
17     }
18
19     public static void main(String JavaDoc[] args) {
20         start(new String JavaDoc[] { TestNull.class.getName()});
21     }
22
23     public static Test suite() {
24         return new TestSuite(TestNull.class);
25     }
26
27     public void testEquals() {
28         assertEquals("Should be same value", new Null(), new Null());
29         assertEquals("Should be same hashCode", new Null().hashCode(), new Null().hashCode());
30
31         assertEquals("Should be same value", new Null("one"), new Null("two"));
32         assertEquals("Should be same hashCode", new Null("one").hashCode(), new Null("two").hashCode());
33
34         // Compare with other objects to assert that they are not equal
35
assertEquals("Not equal to something else", false, new Null("one").equals("one"));
36         assertEquals("Not equal to something else", false, new Null().equals(new Integer JavaDoc(2)));
37     }
38
39     public void testDescription() {
40         assertEquals("Description", "what it is", new Null("what it is").toString());
41     }
42 }
43
Popular Tags