Author: veithen
Date: Sun Jul 10 13:32:03 2011
New Revision: 1144859

URL: http://svn.apache.org/viewvc?rev=1144859&view=rev
Log:
AXIOM-311: Refactored a couple of unit tests related to OMNamespace.

Added:
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestEquals.java
   (with props)
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestEqualsWithNullPrefix.java
   (with props)
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestGetNamespaceURI.java
   (with props)
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestGetPrefix.java
   (with props)
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestHashCode.java
   (with props)
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestObjectEquals.java
   (with props)
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestObjectEqualsWithDifferentPrefixes.java
   (with props)
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestObjectEqualsWithDifferentURIs.java
   (with props)
Removed:
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/OMNamespaceImplTest.java
Modified:
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMNamespace.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMNamespaceImplTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMNamespace.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMNamespace.java?rev=1144859&r1=1144858&r2=1144859&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMNamespace.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMNamespace.java
 Sun Jul 10 13:32:03 2011
@@ -25,6 +25,10 @@ package org.apache.axiom.om;
  * Implementations of this interface must be immutable or behave as if they 
were immutable,
  * i.e. {@link #getPrefix()} and {@link #getNamespaceURI()} must always return 
the same
  * values when invoked on the same instance.
+ * <p>
+ * Implementations must override {@link Object#equals(Object)} and {@link 
Object#hashCode()}. Two
+ * {@link OMNamespace} instances are considered equal if their namespace URIs 
and prefixes are
+ * equal.
  */
 public interface OMNamespace {
     /**

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMNamespaceImplTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMNamespaceImplTest.java?rev=1144859&r1=1144858&r2=1144859&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMNamespaceImplTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMNamespaceImplTest.java
 Sun Jul 10 13:32:03 2011
@@ -19,84 +19,13 @@
 
 package org.apache.axiom.om.impl.llom;
 
-import junit.framework.Test;
 import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import junit.textui.TestRunner;
 import org.apache.axiom.om.impl.OMNamespaceImpl;
 
 import java.lang.reflect.Field;
 
 /** This class will test the methods and fields of the OMNamespaceImpl class. 
*/
 public class OMNamespaceImplTest extends TestCase {
-
-    /**
-     * The main method.
-     *
-     * @param args The command line arguments
-     */
-    public static void main(String[] args) {
-        TestRunner.run(suite());
-    }
-
-    /**
-     * A one arg constructor to allow specifying a single test method to run.
-     *
-     * @param name The name of the test to run
-     */
-    public OMNamespaceImplTest(String name) {
-        super(name);
-    }
-
-    /**
-     * This method returns a test suite of tests to run.
-     *
-     * @return A test suite to be run
-     */
-    public static Test suite() {
-        return new TestSuite(OMNamespaceImplTest.class);
-    }
-
-    public void testGetNamespaceURI() {
-        OMNamespaceImpl omNsImpl =
-                new OMNamespaceImpl("http://www.w3.org/XML/1998/namespace";,
-                                    "xml");
-        assertEquals("http://www.w3.org/XML/1998/namespace";,
-                     omNsImpl.getNamespaceURI());
-    }
-
-    public void testGetPrefix() {
-        OMNamespaceImpl omNsImpl =
-                new OMNamespaceImpl("http://www.w3.org/XML/1998/namespace";,
-                                    "xml");
-        assertEquals("xml", omNsImpl.getPrefix());
-        omNsImpl = new OMNamespaceImpl("", null);
-        assertNull(omNsImpl.getPrefix());
-    }
-
-    /** This method wil test the equals method. */
-    public void testEquals() {
-        OMNamespaceImpl omNsImpl =
-                new OMNamespaceImpl("http://www.w3.org/XML/1998/namespace";,
-                                    null);
-        assertTrue(omNsImpl.equals("http://www.w3.org/XML/1998/namespace";,
-                                   null));
-
-        omNsImpl =
-                new OMNamespaceImpl("http://www.w3.org/XML/1998/namespace";,
-                                    "xml");
-        assertTrue(omNsImpl.equals("http://www.w3.org/XML/1998/namespace";,
-                                   "xml"));
-        assertTrue(!omNsImpl.equals("http://www.w3.org/XML/1998/namespace";,
-                                    "xml2"));
-        assertTrue(!omNsImpl.equals("http://www.w3.org/XML/1998/namespace";,
-                                    null));
-        assertTrue(!omNsImpl.equals("http://www.w3.org/XML/2001/namespace";,
-                                    "xml"));
-        assertTrue(!omNsImpl.equals(null,
-                                    "xml"));
-    }
-
     /**
      * This method will insure that the OMNamespaceImpl class remains 
immutable.
      *

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java?rev=1144859&r1=1144858&r2=1144859&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java
 Sun Jul 10 13:32:03 2011
@@ -150,6 +150,14 @@ public class OMTestSuiteBuilder extends 
         addTest(new 
org.apache.axiom.ts.om.factory.TestCreateOMNamespaceWithNullURI(metaFactory));
         addTest(new 
org.apache.axiom.ts.om.factory.TestCreateOMText(metaFactory));
         addTest(new 
org.apache.axiom.ts.om.factory.TestCreateOMTextFromDataHandlerProvider(metaFactory));
+        addTest(new org.apache.axiom.ts.om.namespace.TestEquals(metaFactory));
+        addTest(new 
org.apache.axiom.ts.om.namespace.TestEqualsWithNullPrefix(metaFactory));
+        addTest(new 
org.apache.axiom.ts.om.namespace.TestGetNamespaceURI(metaFactory));
+        addTest(new 
org.apache.axiom.ts.om.namespace.TestGetPrefix(metaFactory));
+        addTest(new 
org.apache.axiom.ts.om.namespace.TestHashCode(metaFactory));
+        addTest(new 
org.apache.axiom.ts.om.namespace.TestObjectEquals(metaFactory));
+        addTest(new 
org.apache.axiom.ts.om.namespace.TestObjectEqualsWithDifferentPrefixes(metaFactory));
+        addTest(new 
org.apache.axiom.ts.om.namespace.TestObjectEqualsWithDifferentURIs(metaFactory));
         addTest(new org.apache.axiom.ts.om.node.TestDetach(metaFactory, true));
         addTest(new org.apache.axiom.ts.om.node.TestDetach(metaFactory, 
false));
         addTest(new 
org.apache.axiom.ts.om.node.TestInsertSiblingAfter(metaFactory));

Added: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestEquals.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestEquals.java?rev=1144859&view=auto
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestEquals.java
 (added)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestEquals.java
 Sun Jul 10 13:32:03 2011
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.ts.om.namespace;
+
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.ts.AxiomTestCase;
+
+/**
+ * Tests the behavior of {@link OMNamespace#equals(String, String)} for an 
{@link OMNamespace}
+ * instance with non null prefix.
+ */
+public class TestEquals extends AxiomTestCase {
+    public TestEquals(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    protected void runTest() throws Throwable {
+        OMFactory factory = metaFactory.getOMFactory();
+        OMNamespace ns = 
factory.createOMNamespace("http://www.w3.org/XML/1998/namespace";, "xml");
+        assertTrue(ns.equals("http://www.w3.org/XML/1998/namespace";, "xml"));
+        assertFalse(ns.equals("http://www.w3.org/XML/1998/namespace";, "xml2"));
+        assertFalse(ns.equals("http://www.w3.org/XML/1998/namespace";, null));
+        assertFalse(ns.equals("http://www.w3.org/XML/2001/namespace";, "xml"));
+        assertFalse(ns.equals(null, "xml"));
+    }
+}

Propchange: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestEquals.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestEqualsWithNullPrefix.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestEqualsWithNullPrefix.java?rev=1144859&view=auto
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestEqualsWithNullPrefix.java
 (added)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestEqualsWithNullPrefix.java
 Sun Jul 10 13:32:03 2011
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.ts.om.namespace;
+
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.ts.AxiomTestCase;
+
+/**
+ * Tests the behavior of {@link OMNamespace#equals(String, String)} for an 
{@link OMNamespace}
+ * instance with non prefix.
+ */
+public class TestEqualsWithNullPrefix extends AxiomTestCase {
+    public TestEqualsWithNullPrefix(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    protected void runTest() throws Throwable {
+        OMFactory factory = metaFactory.getOMFactory();
+        OMNamespace ns = 
factory.createOMNamespace("http://www.w3.org/XML/1998/namespace";, null);
+        assertTrue(ns.equals("http://www.w3.org/XML/1998/namespace";, null));
+    }
+}

Propchange: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestEqualsWithNullPrefix.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestGetNamespaceURI.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestGetNamespaceURI.java?rev=1144859&view=auto
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestGetNamespaceURI.java
 (added)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestGetNamespaceURI.java
 Sun Jul 10 13:32:03 2011
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.ts.om.namespace;
+
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.ts.AxiomTestCase;
+
+/**
+ * Tests the behavior of {@link OMNamespace#getNamespaceURI()}.
+ */
+public class TestGetNamespaceURI extends AxiomTestCase {
+    public TestGetNamespaceURI(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    protected void runTest() throws Throwable {
+        OMFactory factory = metaFactory.getOMFactory();
+        OMNamespace ns = 
factory.createOMNamespace("http://www.w3.org/XML/1998/namespace";, "xml");
+        assertEquals("http://www.w3.org/XML/1998/namespace";, 
ns.getNamespaceURI());
+    }
+}

Propchange: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestGetNamespaceURI.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestGetPrefix.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestGetPrefix.java?rev=1144859&view=auto
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestGetPrefix.java
 (added)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestGetPrefix.java
 Sun Jul 10 13:32:03 2011
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.ts.om.namespace;
+
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.ts.AxiomTestCase;
+
+/**
+ * Tests the behavior of {@link OMNamespace#getPrefix()}.
+ */
+public class TestGetPrefix extends AxiomTestCase {
+    public TestGetPrefix(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    protected void runTest() throws Throwable {
+        OMFactory factory = metaFactory.getOMFactory();
+        OMNamespace ns = 
factory.createOMNamespace("http://www.w3.org/XML/1998/namespace";, "xml");
+        assertEquals("xml", ns.getPrefix());
+        ns = factory.createOMNamespace("", null);
+        assertNull(ns.getPrefix());
+    }
+}

Propchange: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestGetPrefix.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestHashCode.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestHashCode.java?rev=1144859&view=auto
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestHashCode.java
 (added)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestHashCode.java
 Sun Jul 10 13:32:03 2011
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.ts.om.namespace;
+
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.ts.AxiomTestCase;
+
+/**
+ * Tests that the {@link OMNamespace} overrides {@link Object#hashCode()}.
+ */
+public class TestHashCode extends AxiomTestCase {
+    public TestHashCode(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    protected void runTest() throws Throwable {
+        OMFactory factory = metaFactory.getOMFactory();
+        OMNamespace ns1 = factory.createOMNamespace("urn:ns", "ns");
+        OMNamespace ns2 = factory.createOMNamespace("urn:ns", "ns");
+        assertTrue(ns1.equals(ns2));
+    }
+}

Propchange: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestHashCode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestObjectEquals.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestObjectEquals.java?rev=1144859&view=auto
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestObjectEquals.java
 (added)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestObjectEquals.java
 Sun Jul 10 13:32:03 2011
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.ts.om.namespace;
+
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.ts.AxiomTestCase;
+
+/**
+ * Tests the behavior of {@link Object#equals(Object)} for {@link OMNamespace} 
instances with same
+ * namespace URI and prefix.
+ */
+public class TestObjectEquals extends AxiomTestCase {
+    public TestObjectEquals(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    protected void runTest() throws Throwable {
+        OMFactory factory = metaFactory.getOMFactory();
+        OMNamespace ns1 = factory.createOMNamespace("urn:ns", "ns");
+        OMNamespace ns2 = factory.createOMNamespace("urn:ns", "ns");
+        assertEquals(ns1.hashCode(), ns2.hashCode());
+    }
+}

Propchange: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestObjectEquals.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestObjectEqualsWithDifferentPrefixes.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestObjectEqualsWithDifferentPrefixes.java?rev=1144859&view=auto
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestObjectEqualsWithDifferentPrefixes.java
 (added)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestObjectEqualsWithDifferentPrefixes.java
 Sun Jul 10 13:32:03 2011
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.ts.om.namespace;
+
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.ts.AxiomTestCase;
+
+/**
+ * Tests the behavior of {@link Object#equals(Object)} for {@link OMNamespace} 
instances with
+ * different prefixes.
+ */
+public class TestObjectEqualsWithDifferentPrefixes extends AxiomTestCase {
+    public TestObjectEqualsWithDifferentPrefixes(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    protected void runTest() throws Throwable {
+        OMFactory factory = metaFactory.getOMFactory();
+        OMNamespace ns1 = factory.createOMNamespace("urn:ns", "ns1");
+        OMNamespace ns2 = factory.createOMNamespace("urn:ns", "ns2");
+        assertFalse(ns1.equals(ns2));
+    }
+}

Propchange: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestObjectEqualsWithDifferentPrefixes.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestObjectEqualsWithDifferentURIs.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestObjectEqualsWithDifferentURIs.java?rev=1144859&view=auto
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestObjectEqualsWithDifferentURIs.java
 (added)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestObjectEqualsWithDifferentURIs.java
 Sun Jul 10 13:32:03 2011
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.ts.om.namespace;
+
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.ts.AxiomTestCase;
+
+/**
+ * Tests the behavior of {@link Object#equals(Object)} for {@link OMNamespace} 
instances with
+ * different namespace URIs.
+ */
+public class TestObjectEqualsWithDifferentURIs extends AxiomTestCase {
+    public TestObjectEqualsWithDifferentURIs(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    protected void runTest() throws Throwable {
+        OMFactory factory = metaFactory.getOMFactory();
+        OMNamespace ns1 = factory.createOMNamespace("urn:ns1", "ns");
+        OMNamespace ns2 = factory.createOMNamespace("urn:ns2", "ns");
+        assertFalse(ns1.equals(ns2));
+    }
+}

Propchange: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/namespace/TestObjectEqualsWithDifferentURIs.java
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to