(no commit message)
authorerik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Mon, 27 Mar 2006 22:30:55 +0000 (22:30 +0000)
committererik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Mon, 27 Mar 2006 22:30:55 +0000 (22:30 +0000)
support/test/org/wamblee/xml/XmlUtils.java

index 12292469e06178012a5010af4d636294135eaa23..93d2e917c6d8af8cfa3457c5ed318a83adc9104c 100644 (file)
@@ -93,7 +93,7 @@ public final class XmlUtils {
         List<Attribute> actualAttrs = aActual.attributes();
         Collections.sort(actualAttrs, new AttributeComparator());
 
-        TestCase.assertEquals(aMsg + "/#attributes", expectedAttrs.size(),
+        TestCase.assertEquals(aMsg + "/count(@*)", expectedAttrs.size(),
                 actualAttrs.size());
         for (int i = 0; i < expectedAttrs.size(); i++) {
             String msg = aMsg + "/@" + expectedAttrs.get(i).getName();
@@ -103,9 +103,10 @@ public final class XmlUtils {
         // Nested elements.
         List<Element> expectedElems = aExpected.elements();
         List<Element> actualElems = aActual.elements();
-        TestCase.assertEquals(aMsg + "/#elements", expectedElems.size(),
+        TestCase.assertEquals(aMsg + "/count(*)", expectedElems.size(),
                 actualElems.size());
         // determine the how-manyth element of the given name we are at.
+        // Maps element name to the last used index (or null if not yet used)
         Map<String, Integer> elementIndex = new TreeMap<String, Integer>();
         for (int i = 0; i < expectedElems.size(); i++) {
             String elemName = expectedElems.get(i).getName();
@@ -116,8 +117,8 @@ public final class XmlUtils {
                 index++;
             }
             elementIndex.put(elemName, index);
-            String msg = aMsg + "/" + expectedElems.get(i).getName() + "("
-                    + index + ")";
+            String msg = aMsg + "/" + expectedElems.get(i).getName() + "["
+                    + index + "]";
 
             assertEquals(msg, expectedElems.get(i), actualElems.get(i));
         }