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 Copyright (c) 2001 World Wide Web Consortium,
     10 (Massachusetts Institute of Technology, Institut National de
     11 Recherche en Informatique et en Automatique, Keio University).  All
     12 Rights Reserved.  This program is distributed under the W3C's Software
     13 Intellectual Property License.  This program is distributed in the
     14 hope that it will be useful, but WITHOUT ANY WARRANTY; without even
     15 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     16 PURPOSE.
     17 
     18 See W3C License http://www.w3.org/Consortium/Legal/ for more details.
     19 
     20 
     21 */
     22 
     23 package org.w3c.domts.level2.core;
     24 
     25 import org.w3c.dom.*;
     26 
     27 
     28 import org.w3c.domts.DOMTestCase;
     29 import org.w3c.domts.DOMTestDocumentBuilderFactory;
     30 
     31 
     32 
     33 /**
     34  *     The "feature" parameter in the
     35  *     isSupported(feature,version)" method is the name
     36  *     of the feature and the version is the version number of the
     37  *     feature to test.   XML is a legal value for the feature parameter
     38  *     (Test for XML, upper case).
     39  *     Legal values for the version parameter are 1.0 and 2.0
     40  *     (Test for 2.0).
     41  *
     42  *     Retrieve the root node of the DOM document by invoking
     43  *     the "getDocumentElement()" method.   This should create a
     44  *     node object on which the "isSupported(feature,version)"
     45  *     method is invoked with "feature" equal to "XML" and the version equal to 2.0.
     46  *     The method should return a boolean "true".
     47 * @author NIST
     48 * @author Mary Brady
     49 * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports">http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports</a>
     50 */
     51 public final class isSupported11 extends DOMTestCase {
     52 
     53    /**
     54     * Constructor.
     55     * @param factory document factory, may not be null
     56     * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
     57     */
     58    public isSupported11(final DOMTestDocumentBuilderFactory factory)  throws org.w3c.domts.DOMTestIncompatibleException {
     59       super(factory);
     60 
     61     //
     62     //   check if loaded documents are supported for content type
     63     //
     64     String contentType = getContentType();
     65     preload(contentType, "staff", false);
     66     }
     67 
     68    /**
     69     * Runs the test case.
     70     * @throws Throwable Any uncaught exception causes test to fail
     71     */
     72    public void runTest() throws Throwable {
     73       Document doc;
     74       Node rootNode;
     75       boolean state;
     76       doc = (Document) load("staff", false);
     77       rootNode = doc.getDocumentElement();
     78       state = rootNode.isSupported("XML", "2.0");
     79       assertTrue("throw_True", state);
     80       }
     81    /**
     82     *  Gets URI that identifies the test.
     83     *  @return uri identifier of test
     84     */
     85    public String getTargetURI() {
     86       return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/isSupported11";
     87    }
     88    /**
     89     * Runs this test from the command line.
     90     * @param args command line arguments
     91     */
     92    public static void main(final String[] args) {
     93         DOMTestCase.doMain(isSupported11.class, args);
     94    }
     95 }
     96 
     97