1 package org.sapia.util.xml.test; 2 3 import junit.framework.TestCase; 4 import junit.textui.TestRunner; 5 import org.sapia.util.xml.Namespace; 6 7 18 public class NamespaceTest extends TestCase{ 19 20 public static void main(String [] args) { 21 TestRunner.run(NamespaceTest.class); 22 } 23 24 public NamespaceTest(String aName) { 25 super(aName); 26 } 27 28 31 public void testEmptyNamespace() throws Exception { 32 Namespace aNamespace = new Namespace(); 33 assertNotNull(aNamespace); 34 assertNull(aNamespace.getURI()); 35 assertNull(aNamespace.getPrefix()); 36 assertTrue(aNamespace.hashCode() != 0); 37 assertEquals(aNamespace, new Namespace()); 38 } 39 40 43 public void testValidNamespace() throws Exception { 44 Namespace aNamespace = new Namespace(); 45 aNamespace.setURI("http://schemas.sapia.org/"); 46 aNamespace.setPrefix("A"); 47 assertNotNull(aNamespace); 48 assertEquals("http://schemas.sapia.org/", aNamespace.getURI()); 49 assertEquals("A", aNamespace.getPrefix()); 50 assertTrue(aNamespace.hashCode() != 0); 51 assertTrue(!aNamespace.equals(new Namespace())); 52 assertEquals(aNamespace, new Namespace("http://schemas.sapia.org/", "A")); 53 } 54 } 55 | Popular Tags |