1 15 package org.apache.tapestry.record; 16 17 import org.apache.hivemind.test.HiveMindTestCase; 18 19 25 public class TestChangeKey extends HiveMindTestCase 26 { 27 public void testSetters() 28 { 29 ChangeKey key = new ChangeKey("path", "name"); 30 31 assertEquals("path", key.getComponentPath()); 32 assertEquals("name", key.getPropertyName()); 33 34 key = new ChangeKey(null, "foo"); 35 36 assertNull(key.getComponentPath()); 37 assertEquals("foo", key.getPropertyName()); 38 } 39 40 public void testHashCode() 41 { 42 ChangeKey key1 = new ChangeKey("path", "name1"); 43 ChangeKey key2 = new ChangeKey("path", "name1"); 44 ChangeKey key3 = new ChangeKey(null, "name2"); 45 46 assertEquals(key1.hashCode(), key2.hashCode()); 47 assertTrue(key1.hashCode() != key3.hashCode()); 48 } 49 50 public void testEquals() 51 { 52 ChangeKey key1 = new ChangeKey("path", "name1"); 53 ChangeKey key2 = new ChangeKey("path", "name1"); 54 ChangeKey key3 = new ChangeKey(null, "name2"); 55 56 assertTrue(key1.equals(key2)); 57 assertFalse(key1.equals(key3)); 58 59 assertFalse(key1.equals(null)); 60 assertTrue(key1.equals(key1)); 61 assertFalse(key1.equals("foo")); 62 } 63 } | Popular Tags |