KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > jmock > expectation > NullTest


1 /* Copyright (c) 2000-2004 jMock.org
2  */

3 package test.jmock.expectation;
4
5 import junit.framework.TestCase;
6 import org.jmock.expectation.Null;
7
8
9 public class NullTest extends TestCase
10 {
11
12     public void testEquals() {
13         assertEquals("Should be same value", new Null(), new Null());
14         assertEquals("Should be same hashCode", new Null().hashCode(), new Null().hashCode());
15
16         assertEquals("Should be same value", new Null("one"), new Null("two"));
17         assertEquals("Should be same hashCode", new Null("one").hashCode(), new Null("two").hashCode());
18
19         // Compare with other objects to assert that they are not equal
20
assertEquals("Not equal to something else", false, new Null("one").equals("one"));
21         assertEquals("Not equal to something else", false, new Null().equals(new Integer JavaDoc(2)));
22     }
23
24     public void testDescription() {
25         assertEquals("Description", "what it is", new Null("what it is").toString());
26     }
27 }
28
Popular Tags