1
2/*
3This Java source file was generated by test-to-java.xsl
4and is a derived work from the source document.
5The source document contained the following notice:
6
7
8
9Copyright (c) 2001-2003 World Wide Web Consortium,
10(Massachusetts Institute of Technology, Institut National de
11Recherche en Informatique et en Automatique, Keio University).  All
12Rights Reserved.  This program is distributed under the W3C's Software
13Intellectual Property License.  This program is distributed in the
14hope that it will be useful, but WITHOUT ANY WARRANTY; without even
15the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16PURPOSE.
17
18See W3C License http://www.w3.org/Consortium/Legal/ for more details.
19
20
21*/
22
23package org.w3c.domts.level2.core;
24
25import org.w3c.dom.*;
26
27
28import org.w3c.domts.DOMTestCase;
29import org.w3c.domts.DOMTestDocumentBuilderFactory;
30
31
32
33/**
34 *  The method "isSupported(feature,version)" Tests whether the DOM implementation
35 *  implements a specific feature and that feature is supported by this node.
36 *
37 *  Call the isSupported method on a new attribute node with a combination of features
38 *  versions and versions as below.  Valid feature names are case insensitive and versions
39 *  "2.0", "1.0" and if the version is not specified, supporting any version of the feature
40 *  should return true.  Check if the value returned value was true.
41* @author IBM
42* @author Neil Delima
43* @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>
44*/
45public final class nodeissupported02 extends DOMTestCase {
46
47   /**
48    * Constructor.
49    * @param factory document factory, may not be null
50    * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
51    */
52   public nodeissupported02(final DOMTestDocumentBuilderFactory factory)  throws org.w3c.domts.DOMTestIncompatibleException {
53      super(factory);
54
55    //
56    //   check if loaded documents are supported for content type
57    //
58    String contentType = getContentType();
59    preload(contentType, "staffNS", false);
60    }
61
62   /**
63    * Runs the test case.
64    * @throws Throwable Any uncaught exception causes test to fail
65    */
66   public void runTest() throws Throwable {
67      Document doc;
68      Attr attribute;
69      String version = "";
70      String version1 = "1.0";
71      String version2 = "2.0";
72      String featureCore;
73      String featureXML;
74      boolean success;
75      java.util.List featuresXML = new java.util.ArrayList();
76      featuresXML.add("XML");
77      featuresXML.add("xmL");
78
79      java.util.List featuresCore = new java.util.ArrayList();
80      featuresCore.add("Core");
81      featuresCore.add("CORE");
82
83      doc = (Document) load("staffNS", false);
84      attribute = doc.createAttribute("TestAttr");
85      for (int indexN10064 = 0; indexN10064 < featuresXML.size(); indexN10064++) {
86          featureXML = (String) featuresXML.get(indexN10064);
87    success = attribute.isSupported(featureXML, version);
88      assertTrue("nodeissupported02_XML1", success);
89      success = attribute.isSupported(featureXML, version1);
90      assertTrue("nodeissupported02_XML2", success);
91        }
92      for (int indexN1007D = 0; indexN1007D < featuresCore.size(); indexN1007D++) {
93          featureCore = (String) featuresCore.get(indexN1007D);
94    success = attribute.isSupported(featureCore, version);
95      assertTrue("nodeissupported02_Core1", success);
96      success = attribute.isSupported(featureCore, version1);
97      success = attribute.isSupported(featureCore, version2);
98      assertTrue("nodeissupported02_Core3", success);
99        }
100      }
101   /**
102    *  Gets URI that identifies the test.
103    *  @return uri identifier of test
104    */
105   public String getTargetURI() {
106      return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodeissupported02";
107   }
108   /**
109    * Runs this test from the command line.
110    * @param args command line arguments
111    */
112   public static void main(final String[] args) {
113        DOMTestCase.doMain(nodeissupported02.class, args);
114   }
115}
116
117