You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2015/05/07 20:59:17 UTC

svn commit: r1678257 - in /webservices/axiom/trunk/testing/testutils: pom.xml src/main/java/org/apache/axiom/testutils/stax/XMLStreamReaderComparator.java

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));
+                }
             }
         }
     }