blob: 8165b2ce973dfd76c327aaf442374c9b14a0c618 [file] [log] [blame]
The Android Open Source Projectadc854b2009-03-03 19:28:47 -08001
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 tests.org.w3c.dom;
24
25import dalvik.annotation.TestTargets;
26import dalvik.annotation.TestLevel;
27import dalvik.annotation.TestTargetNew;
28import dalvik.annotation.TestTargetClass;
29
30import org.w3c.dom.DocumentType;
31import org.w3c.dom.Document;
32
33import javax.xml.parsers.DocumentBuilder;
34
35/**
36 * The "getPublicId()" method of a documenttype node contains
37 * the public identifier associated with the external subset.
38 *
39 * Retrieve the documenttype.
40 * Apply the "getPublicId()" method. The string "STAFF" should be
41 * returned.
42* @author NIST
43* @author Mary Brady
44* @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-publicId">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-publicId</a>
45*/
46@TestTargetClass(DocumentType.class)
47public final class PublicId extends DOMTestCase {
48
49 DOMDocumentBuilderFactory factory;
50
51 DocumentBuilder builder;
52
53 protected void setUp() throws Exception {
54 super.setUp();
55 try {
56 factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
57 .getConfiguration1());
58 builder = factory.getBuilder();
59 } catch (Exception e) {
60 fail("Unexpected exception" + e.getMessage());
61 }
62 }
63
64 protected void tearDown() throws Exception {
65 factory = null;
66 builder = null;
67 super.tearDown();
68 }
69
70 /**
71 * Runs the test case.
72 * @throws Throwable Any uncaught exception causes test to fail
73 */
74 @TestTargetNew(
75 level = TestLevel.COMPLETE,
76 notes = "",
77 method = "getPublicId",
78 args = {}
79 )
80 public void testGetPublicId() throws Throwable {
81 Document doc;
82 DocumentType docType;
83 String publicId;
84 doc = (Document) load("staffNS", builder);
85 docType = doc.getDoctype();
86 publicId = docType.getPublicId();
87 assertEquals("throw_Equals", "STAFF", publicId);
88 }
89
90}
91