1 7 8 package org.netbeans.modules.xml.xdm.visitor; 9 10 import junit.framework.*; 11 import java.util.ArrayList ; 12 import java.util.HashMap ; 13 import java.util.List ; 14 import java.util.Map ; 15 import org.netbeans.modules.xml.xdm.nodes.Attribute; 16 import org.netbeans.modules.xml.xdm.nodes.Node; 17 import org.netbeans.modules.xml.xdm.nodes.Document; 18 import org.w3c.dom.NamedNodeMap ; 19 import org.netbeans.modules.xml.xdm.XDMModel; 20 import org.netbeans.modules.xml.xdm.Util; 21 22 26 public class FindNamespaceVisitorTest extends TestCase { 27 28 public FindNamespaceVisitorTest(String testName) { 29 super(testName); 30 } 31 32 protected void setUp() throws Exception { 33 } 34 35 public static Test suite() { 36 TestSuite suite = new TestSuite(FindNamespaceVisitorTest.class); 37 38 return suite; 39 } 40 41 44 public void testFindNamespace() throws Exception { 45 46 XDMModel xdmModel = Util.loadXDMModel("diff/TravelItinerary1.xsd"); 47 Document root = xdmModel.getDocument(); 48 FindNamespaceVisitor instance = new FindNamespaceVisitor(root); 49 50 Node target = (Node)root.getDocumentElement().getChildNodes().item(19). 51 getChildNodes().item(3).getChildNodes().item(3); 52 String expResult = "http://www.w3.org/2001/XMLSchema"; 53 String result = instance.findNamespace(target); 54 assertEquals(expResult, result); 55 56 target = (Node)root.getDocumentElement().getChildNodes().item(19). 57 getChildNodes().item(3).getChildNodes().item(3).getAttributes().item(0); 58 expResult = null; 59 result = instance.findNamespace(target); 60 assertEquals(expResult, result); 61 } 62 63 } 64 | Popular Tags |