ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1678257 - in /webservices/axiom/trunk/testing/testutils: pom.xml src/main/java/org/apache/axiom/testutils/stax/XMLStreamReaderComparator.java
Date Thu, 07 May 2015 18:59:17 GMT
Author: veithen
Date: Thu May  7 18:59:16 2015
New Revision: 1678257

URL: http://svn.apache.org/r1678257
Log:
Fixed an incorrect assertion in XMLStreamReaderComparator.

Modified:
    webservices/axiom/trunk/testing/testutils/pom.xml
    webservices/axiom/trunk/testing/testutils/src/main/java/org/apache/axiom/testutils/stax/XMLStreamReaderComparator.java

Modified: webservices/axiom/trunk/testing/testutils/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/testutils/pom.xml?rev=1678257&r1=1678256&r2=1678257&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/testutils/pom.xml (original)
+++ webservices/axiom/trunk/testing/testutils/pom.xml Thu May  7 18:59:16 2015
@@ -51,6 +51,10 @@
             <artifactId>junit</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest-library</artifactId>
+        </dependency>
+        <dependency>
             <groupId>xmlunit</groupId>
             <artifactId>xmlunit</artifactId>
         </dependency>

Modified: webservices/axiom/trunk/testing/testutils/src/main/java/org/apache/axiom/testutils/stax/XMLStreamReaderComparator.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/testutils/src/main/java/org/apache/axiom/testutils/stax/XMLStreamReaderComparator.java?rev=1678257&r1=1678256&r2=1678257&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/testutils/src/main/java/org/apache/axiom/testutils/stax/XMLStreamReaderComparator.java
(original)
+++ webservices/axiom/trunk/testing/testutils/src/main/java/org/apache/axiom/testutils/stax/XMLStreamReaderComparator.java
Thu May  7 18:59:16 2015
@@ -18,7 +18,9 @@
  */
 package org.apache.axiom.testutils.stax;
 
+import static org.hamcrest.Matchers.isIn;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.fail;
 
 import java.lang.reflect.InvocationTargetException;
@@ -177,14 +179,19 @@ public class XMLStreamReaderComparator {
         }
         for (String namespaceURI : namespaceURIs) {
             if (namespaceURI != null && namespaceURI.length() > 0) {
-                assertEquals(
-                        "Prefix for namespace URI '" + namespaceURI + "' (" + getLocation()
+ ")",
-                        expected.getPrefix(namespaceURI),
-                        actual.getPrefix(namespaceURI));
+                Set<String> prefixes = toPrefixSet(expected.getPrefixes(namespaceURI));
                 assertEquals(
                         "Prefixes for namespace URI '" + namespaceURI + "' (" + getLocation()
+ ")",
-                        toPrefixSet(expected.getPrefixes(namespaceURI)),
+                        prefixes,
                         toPrefixSet(actual.getPrefixes(namespaceURI)));
+                if (prefixes.size() <= 1) {
+                    assertEquals(
+                            "Prefix for namespace URI '" + namespaceURI + "' (" + getLocation()
+ ")",
+                            expected.getPrefix(namespaceURI),
+                            actual.getPrefix(namespaceURI));
+                } else {
+                    assertThat(actual.getPrefix(namespaceURI), isIn(prefixes));
+                }
             }
         }
     }



Mime
View raw message