1 57 58 package wsdl; 59 60 import javax.xml.namespace.QName ; 61 62 import junit.framework.*; 63 64 public class QNameTest extends TestCase { 65 66 public static void main(String [] args) { 67 junit.textui.TestRunner.run(suite()); 68 } 69 70 public static Test suite() { 71 return new TestSuite(QNameTest.class); 72 } 73 74 public QNameTest(String name) { 75 super(name); 76 } 77 78 81 public void testEquals() throws Exception { 82 String base = "http://schemas.xmlsoap.org/wsdl/"; 83 QName qn1 = new QName ("http://schemas.xmlsoap.org/wsdl/java/", "java"); 84 assertTrue("One instance is the same as itself", qn1.equals(qn1)); 85 QName qn2 = new QName ("http://schemas.xmlsoap.org/wsdl/java/", "java"); 86 assertTrue("Two equivalent instances are equal qn1=qn2", qn1.equals(qn2)); 87 assertTrue("Two equivalent instances are equal qn2=qn1", qn2.equals(qn1)); 88 89 QName qn3 = new QName ("http://ibm.com/","java"); 90 assertTrue("Different URI: instances are not equal qn3!=qn1", !qn3.equals(qn1)); 91 assertTrue("Different URI: instances are not equal qn1!=qn3", !qn1.equals(qn3)); 92 93 QName qn4 = new QName ("http://schemas.xmlsoap.org/wsdl/java/", "soap"); 94 assertTrue("Different name: instances are not equal qn4!=qn1", !qn4.equals(qn1)); 95 assertTrue("Different name: instances are not equal qn1!=qn4", !qn1.equals(qn4)); 96 97 QName qn5 = new QName ("http://schemas.xmlsoap.org/wsdl/java", "java"); 98 assertTrue("URI: No trailing / same as trailing slash URI", qn5.equals(qn1)); 99 assertTrue("URI: No trailing / same as trailing slash URI", qn1.equals(qn5)); 100 101 } 102 } 103 | Popular Tags |