Home | History | Annotate | Download | only in core
      1 
      2 /*
      3 This Java source file was generated by test-to-java.xsl
      4 and is a derived work from the source document.
      5 The source document contained the following notice:
      6 
      7 
      8 
      9 
     10 
     11 Copyright (c) 2001 World Wide Web Consortium,
     12 
     13 (Massachusetts Institute of Technology, Institut National de
     14 
     15 Recherche en Informatique et en Automatique, Keio University).  All
     16 
     17 Rights Reserved.  This program is distributed under the W3C's Software
     18 
     19 Intellectual Property License.  This program is distributed in the
     20 
     21 hope that it will be useful, but WITHOUT ANY WARRANTY; without even
     22 
     23 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     24 
     25 PURPOSE.
     26 
     27 
     28 
     29 See W3C License http://www.w3.org/Consortium/Legal/ for more details.
     30 
     31 
     32 
     33 
     34 */
     35 
     36 package org.w3c.domts.level2.core;
     37 
     38 import org.w3c.dom.*;
     39 
     40 
     41 import org.w3c.domts.DOMTestCase;
     42 import org.w3c.domts.DOMTestDocumentBuilderFactory;
     43 
     44 
     45 
     46 /**
     47  *  The createDocument method should raise a NAMESPACE_ERR if the qualifiedName is malformed
     48  *
     49  *  Invoke the createDocument method on this DOMImplementation object with null values
     50  *  for namespaceURI and docType and a malformed qualifiedName.
     51  *  The NAMESPACE_ERR should be raised.
     52 * @author IBM
     53 * @author Neil Delima
     54 * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument">http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument</a>
     55 */
     56 public final class domimplementationcreatedocument07 extends DOMTestCase {
     57 
     58    /**
     59     * Constructor.
     60     * @param factory document factory, may not be null
     61     * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
     62     */
     63    public domimplementationcreatedocument07(final DOMTestDocumentBuilderFactory factory)  throws org.w3c.domts.DOMTestIncompatibleException {
     64       super(factory);
     65 
     66     //
     67     //   check if loaded documents are supported for content type
     68     //
     69     String contentType = getContentType();
     70     preload(contentType, "staffNS", false);
     71     }
     72 
     73    /**
     74     * Runs the test case.
     75     * @throws Throwable Any uncaught exception causes test to fail
     76     */
     77    public void runTest() throws Throwable {
     78       Document doc;
     79       DOMImplementation domImpl;
     80       Document newDoc;
     81       String namespaceURI = "http://www.w3.org/DOMTest/level2";
     82       DocumentType docType = null;
     83 
     84       doc = (Document) load("staffNS", false);
     85       domImpl = doc.getImplementation();
     86 
     87       {
     88          boolean success = false;
     89          try {
     90             newDoc = domImpl.createDocument(namespaceURI, ":", docType);
     91           } catch (DOMException ex) {
     92             success = (ex.code == DOMException.NAMESPACE_ERR);
     93          }
     94          assertTrue("domimplementationcreatedocument07", success);
     95       }
     96 }
     97    /**
     98     *  Gets URI that identifies the test.
     99     *  @return uri identifier of test
    100     */
    101    public String getTargetURI() {
    102       return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocument07";
    103    }
    104    /**
    105     * Runs this test from the command line.
    106     * @param args command line arguments
    107     */
    108    public static void main(final String[] args) {
    109         DOMTestCase.doMain(domimplementationcreatedocument07.class, args);
    110    }
    111 }
    112 
    113