alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 * SchemaParserTest.java
 * NetBeans JUnit based test
 *
 * Created on July 24, 2002, 11:44 PM
 */

package org.netbeans.modules.xml.core.wizard;

import java.io.IOException;
import java.net.URL;
import java.util.Set;
import java.util.TreeSet;
import junit.framework.*;
import org.netbeans.api.xml.services.UserCatalog;
import org.netbeans.junit.*;
import org.openide.util.Lookup;
import org.openide.xml.XMLUtil;
import org.xml.sax.*;
import org.xml.sax.helpers.*;

/**
 *
 * @author Petr Kuzel 
 */
public class SchemaParserTest extends NbTestCase {
    
    public SchemaParserTest(java.lang.String testName) {
        super(testName);
    }
    
    public static void main(java.lang.String[] args) {
        junit.textui.TestRunner.run(suite());
    }
    
    public static Test suite() {
        TestSuite suite = new NbTestSuite(SchemaParserTest.class);
        
        return suite;
    }
    
    /** Test of parse method, of class org.netbeans.modules.xml.core.wizard.SchemaParser. */
    public void testParse() {
        System.out.println("testParse");
        
        URL ns = getClass().getResource("data/schemaWithNS.xsd");
        SchemaParser parser = new SchemaParser();

        SchemaParser.SchemaInfo info = parser.parse(ns.toExternalForm());        
        assertTrue("root expected",info.roots.contains("root"));
        assertTrue("ns expected", "test:schemaWithNS".equals(info.namespace));
        assertTrue("unexpected root", info.roots.contains("seq1") == false);
    }
            
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.