2 This Java source file was generated by test-to-java.xsl
3 and is a derived work from the source document.
4 The source document contained the following notice:
8 Copyright (c) 2001-2003 World Wide Web Consortium,
9 (Massachusetts Institute of Technology, Institut National de
10 Recherche en Informatique et en Automatique, Keio University). All
11 Rights Reserved. This program is distributed under the W3C's Software
12 Intellectual Property License. This program is distributed in the
13 hope that it will be useful, but WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
17 See W3C License http://www.w3.org/Consortium/Legal/ for more details.
22 package tests.org.w3c.dom;
24 import dalvik.annotation.TestTargets;
25 import dalvik.annotation.TestLevel;
26 import dalvik.annotation.TestTargetNew;
27 import dalvik.annotation.TestTargetClass;
29 import org.w3c.dom.Document;
30 import org.w3c.dom.Element;
32 import javax.xml.parsers.DocumentBuilder;
35 * The "getElementById(elementId)" method for a Document should return an
36 * element whose ID matches elementId.
38 * Invoke method getElementById(elementId) on this document with elementId
39 * equals "CANADA". Method should return an element whose tag name is
45 * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-104682815">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-104682815</a>
47 * href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=383">http://www.w3.org/Bugs/Public/show_bug.cgi?id=383</a>
49 @TestTargetClass(Document.class)
50 public final class GetElementById extends DOMTestCase {
52 DOMDocumentBuilderFactory factory;
54 DocumentBuilder builder;
56 protected void setUp() throws Exception {
59 factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
60 .getConfiguration1());
61 builder = factory.getBuilder();
62 } catch (Exception e) {
63 fail("Unexpected exception" + e.getMessage());
67 protected void tearDown() throws Exception {
77 * Any uncaught exception causes test to fail
79 // Assumes validation.
80 // public void testGetElementById1() throws Throwable {
84 // doc = (Document) load("staffNS", builder);
85 // element = doc.getElementById("CANADA");
86 // tagname = element.getTagName();
87 // assertEquals("throw_Equals", "emp:address", tagname);
90 level = TestLevel.PARTIAL,
91 notes = "Doesn't verify getElementById method for existent element.",
92 method = "getElementById",
93 args = {java.lang.String.class}
95 public void testGetElementById2() throws Throwable {
98 doc = (Document) load("staffNS", builder);
99 element = doc.getElementById("Cancun");
100 assertNull("throw_Null", element);