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 12 13 public class TestNull extends TestCaseMo { 14 15 public TestNull(String name) { 16 super(name); 17 } 18 19 public static void main(String [] args) { 20 start(new String [] { 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 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 (2))); 37 } 38 39 public void testDescription() { 40 assertEquals("Description", "what it is", new Null("what it is").toString()); 41 } 42 } 43 | Popular Tags |