aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hiesserich2013-06-07 11:34:39 (EDT)
committerFlorian Thienel2013-06-07 11:34:39 (EDT)
commitcbfae74779db3830810fdf8b4872c0db700417b4 (patch)
tree269fd2c8fa811254f0fde569104aa31b4ed3ce61
parent8cd6d1a64b27b676e2a5409d4d17dcf6390f6d7a (diff)
downloadorg.eclipse.mylyn.docs.vex-cbfae74779db3830810fdf8b4872c0db700417b4.zip
org.eclipse.mylyn.docs.vex-cbfae74779db3830810fdf8b4872c0db700417b4.tar.gz
org.eclipse.mylyn.docs.vex-cbfae74779db3830810fdf8b4872c0db700417b4.tar.bz2
test for undeclared attribute namespaces
https://bugs.eclipse.org/bugs/show_bug.cgi?id=409647
-rw-r--r--org.eclipse.vex.core.tests/src/org/eclipse/vex/core/internal/dom/NamespaceTest.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/org.eclipse.vex.core.tests/src/org/eclipse/vex/core/internal/dom/NamespaceTest.java b/org.eclipse.vex.core.tests/src/org/eclipse/vex/core/internal/dom/NamespaceTest.java
index 24477f8..2c7e02b 100644
--- a/org.eclipse.vex.core.tests/src/org/eclipse/vex/core/internal/dom/NamespaceTest.java
+++ b/org.eclipse.vex.core.tests/src/org/eclipse/vex/core/internal/dom/NamespaceTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Florian Thienel and others.
+ * Copyright (c) 2010, 2013 Florian Thienel and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,8 @@
*
* Contributors:
* Florian Thienel - initial API and implementation
+ * Carsten Hiesserich - test for handling of attribute namespaces in FindUndeclaredNamespacesVisitor
+ *
*******************************************************************************/
package org.eclipse.vex.core.internal.dom;
@@ -355,4 +357,20 @@ public class NamespaceTest {
assertTrue(undeclaredNamespaces.contains("http://namespace/uri/3"));
assertFalse(undeclaredNamespaces.contains("http://namespace/default"));
}
+
+ @Test
+ public void findUndeclaredAttributeNamespaces() throws Exception {
+ final Element parent = new Element(new QualifiedName("http://namespace/default", "parent"));
+ parent.declareDefaultNamespace("http://namespace/default");
+ parent.declareNamespace("ns2", "http://namespace/uri/2");
+
+ parent.addChild(new Element(new QualifiedName(null, "child")));
+
+ ((IElement) parent.children().get(0)).setAttribute(new QualifiedName("http://namespace/uri/1", "attr1"), "val1");
+ ((IElement) parent.children().get(0)).setAttribute(new QualifiedName("http://namespace/uri/2", "attr2"), "val12");
+
+ final Set<String> undeclaredNamespaces = parent.accept(new FindUndeclaredNamespacesVisitor());
+ assertTrue(undeclaredNamespaces.contains("http://namespace/uri/1"));
+ assertFalse(undeclaredNamespaces.contains("http://namespace/uri/2"));
+ }
}