KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > core > wizard > DTDParserTest


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 /*
20  * DTDParserTest.java
21  * NetBeans JUnit based test
22  *
23  * Created on April 10, 2002, 9:06 AM
24  */

25
26 package org.netbeans.modules.xml.core.wizard;
27
28 import java.io.*;
29 import java.net.URL JavaDoc;
30 import java.util.*;
31 import junit.framework.*;
32 import org.netbeans.junit.*;
33 import org.xml.sax.*;
34 import org.xml.sax.ext.*;
35 import org.xml.sax.helpers.*;
36 import org.openide.xml.*;
37 import org.openide.util.Lookup;
38 import org.netbeans.modules.xml.core.tree.ModuleEntityResolver;
39
40 /**
41  * Must be executed in IDE with mounted NetBEans XML Catalog.
42  *
43  * @author Petr Kuzel
44  */

45 public class DTDParserTest extends NbTestCase {
46     
47     public DTDParserTest(java.lang.String JavaDoc testName) {
48         super(testName);
49     }
50     
51     public static void main(java.lang.String JavaDoc[] args) {
52         junit.textui.TestRunner.run(suite());
53     }
54     
55     public static Test suite() {
56         TestSuite suite = new NbTestSuite(DTDParserTest.class);
57         
58         return suite;
59     }
60     
61     /** Test of parse method, of class org.netbeans.modules.xml.core.wizard.DTDParser. */
62     public void testParse() {
63         URL JavaDoc dtd = getClass().getResource("data/dtd.dtd");
64         InputSource in = new InputSource(dtd.toExternalForm());
65         Set roots = new DTDParser().parse(in);
66         assertTrue("Expected decl not found!", roots.contains("root"));
67     }
68     
69 }
70
Popular Tags