You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2013/09/17 16:28:20 UTC

svn commit: r1524064 - in /sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test: Assert.java XMLComparator.java

Author: desruisseaux
Date: Tue Sep 17 14:28:19 2013
New Revision: 1524064

URL: http://svn.apache.org/r1524064
Log:
Tests need to ignore the prefix when comparing element names (patch by Guilhem Legal).

Modified:
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/XMLComparator.java

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java?rev=1524064&r1=1524063&r2=1524064&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java [UTF-8] Tue Sep 17 14:28:19 2013
@@ -236,9 +236,7 @@ public strictfp class Assert extends org
      *   <li>{@link org.w3c.dom.Node}: used directly without further processing.</li>
      *   <li>{@link java.io.File}, {@link java.net.URL} or {@link java.net.URI}: the
      *       stream is opened and parsed as a XML document.</li>
-     *   <li>{@link String}: The string content is parsed directly as a XML document.
-     *       Encoding <strong>must</strong> be UTF-8 (no other encoding is supported
-     *       by current implementation of this method).</li>
+     *   <li>{@link String}: The string content is parsed directly as a XML document.</li>
      * </ul>
      *
      * This method will ignore comments and the optional attributes given in arguments.

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/XMLComparator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/XMLComparator.java?rev=1524064&r1=1524063&r2=1524064&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/XMLComparator.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/XMLComparator.java [UTF-8] Tue Sep 17 14:28:19 2013
@@ -186,11 +186,8 @@ public strictfp class XMLComparator {
      *
      * <ul>
      *   <li>{@link Node}; used directly without further processing.</li>
-     *   <li>{@link File}, {@link URL} or {@link URI}: the stream is opened and parsed
-     *       as a XML document.</li>
-     *   <li>{@link String}: The string content is parsed directly as a XML document.
-     *       Encoding <strong>must</strong> be UTF-8 (no other encoding is supported
-     *       by current implementation of this method).</li>
+     *   <li>{@link File}, {@link URL} or {@link URI}: the stream is opened and parsed as a XML document.</li>
+     *   <li>{@link String}: The string content is parsed directly as a XML document.</li>
      * </ul>
      *
      * @param  expected  The expected XML document.
@@ -441,7 +438,13 @@ public strictfp class XMLComparator {
      */
     protected void compareNames(final Node expected, final Node actual) {
         assertPropertyEquals("namespace", expected.getNamespaceURI(), actual.getNamespaceURI(), expected, actual);
-        assertPropertyEquals("name",      expected.getNodeName(),     actual.getNodeName(),     expected, actual);
+        String expectedName = expected.getLocalName();
+        String actualName   = actual.getLocalName();
+        if (expectedName == null || actualName == null) {
+            expectedName = expected.getNodeName();
+            actualName   = actual.getNodeName();
+        }
+        assertPropertyEquals("name", expectedName, actualName, expected, actual);
     }
 
     /**