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 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 "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 * The method should return "false" since 9.0 is not a valid version. 39 * 40 * Retrieve the root node of the DOM document by invoking 41 * the "getDocumentElement()" method. This should create a 42 * node object on which the "isSupported(feature,version)" 43 * method is invoked with "feature" equal to "XML" and version to "9.0". 44 * The method should return a boolean "false" since 9.0 is not a valid version. 45* @author NIST 46* @author Mary Brady 47* @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> 48*/ 49public final class isSupported02 extends DOMTestCase { 50 51 /** 52 * Constructor. 53 * @param factory document factory, may not be null 54 * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration 55 */ 56 public isSupported02(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException { 57 super(factory); 58 59 // 60 // check if loaded documents are supported for content type 61 // 62 String contentType = getContentType(); 63 preload(contentType, "staff", false); 64 } 65 66 /** 67 * Runs the test case. 68 * @throws Throwable Any uncaught exception causes test to fail 69 */ 70 public void runTest() throws Throwable { 71 Document doc; 72 Node rootNode; 73 boolean state; 74 doc = (Document) load("staff", false); 75 rootNode = doc.getDocumentElement(); 76 state = rootNode.isSupported("XML", "9.0"); 77 assertFalse("throw_False", state); 78} 79 /** 80 * Gets URI that identifies the test. 81 * @return uri identifier of test 82 */ 83 public String getTargetURI() { 84 return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/isSupported02"; 85 } 86 /** 87 * Runs this test from the command line. 88 * @param args command line arguments 89 */ 90 public static void main(final String[] args) { 91 DOMTestCase.doMain(isSupported02.class, args); 92 } 93} 94 95