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 "feature" parameter in the
     48  *    "hasFeature(feature,version)" method is the package name
     49  *    of the feature.  Legal values are XML and HTML and CORE.
     50  *    (Test for feature core, lower case)
     51  *
     52  *    Retrieve the entire DOM document and invoke its
     53  *    "getImplementation()" method.  This should create a
     54  *    DOMImplementation object whose "hasFeature(feature,
     55  *    version)" method is invoked with feature equal to "core".
     56  *    The method should return a boolean "true".
     57 * @author NIST
     58 * @author Mary Brady
     59 * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7</a>
     60 */
     61 public final class domimplementationfeaturecore extends DOMTestCase {
     62 
     63    /**
     64     * Constructor.
     65     * @param factory document factory, may not be null
     66     * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
     67     */
     68    public domimplementationfeaturecore(final DOMTestDocumentBuilderFactory factory)  throws org.w3c.domts.DOMTestIncompatibleException {
     69       super(factory);
     70 
     71     //
     72     //   check if loaded documents are supported for content type
     73     //
     74     String contentType = getContentType();
     75     preload(contentType, "staff", false);
     76     }
     77 
     78    /**
     79     * Runs the test case.
     80     * @throws Throwable Any uncaught exception causes test to fail
     81     */
     82    public void runTest() throws Throwable {
     83       Document doc;
     84       DOMImplementation domImpl;
     85       boolean state;
     86       doc = (Document) load("staff", false);
     87       domImpl = doc.getImplementation();
     88       state = domImpl.hasFeature("core", "2.0");
     89 assertTrue("domimplementationFeaturecoreAssert", state);
     90       }
     91    /**
     92     *  Gets URI that identifies the test.
     93     *  @return uri identifier of test
     94     */
     95    public String getTargetURI() {
     96       return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationfeaturecore";
     97    }
     98    /**
     99     * Runs this test from the command line.
    100     * @param args command line arguments
    101     */
    102    public static void main(final String[] args) {
    103         DOMTestCase.doMain(domimplementationfeaturecore.class, args);
    104    }
    105 }
    106 
    107