blob: fcad02478799980ddfa5b0b6ac3bc5b839e762e8 [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;
32import org.w3c.dom.DOMImplementation;
33
34import javax.xml.parsers.DocumentBuilder;
35
36/**
37 * The method getInternalSubset() returns the public identifier of the external subset.
38 *
39 * Create a new DocumentType node with the value "SYS" for its systemId and PUB for
40 * its publicId. Check the value of the systemId and pbulicId attributes.
41* @author IBM
42* @author Neil Delima
43* @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-systemId">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-systemId</a>
44*/
45@TestTargetClass(DocumentType.class)
46public final class DocumentTypeSystemId extends DOMTestCase {
47 DOMDocumentBuilderFactory factory;
48
49 DocumentBuilder builder;
50
51 protected void setUp() throws Exception {
52 super.setUp();
53 try {
54 factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
55 .getConfiguration1());
56 builder = factory.getBuilder();
57 } catch (Exception e) {
58 fail("Unexpected exception" + e.getMessage());
59 }
60 }
61
62 protected void tearDown() throws Exception {
63 factory = null;
64 builder = null;
65 super.tearDown();
66 }
67
68
69 /**
70 * Runs the test case.
71 * @throws Throwable Any uncaught exception causes test to fail
72 */
73 @TestTargetNew(
74 level = TestLevel.COMPLETE,
75 notes = "",
76 method = "getSystemId",
77 args = {}
78 )
79 public void testGetSystemId() throws Throwable {
80 Document doc;
81 DocumentType docType;
82 DOMImplementation domImpl;
83 String publicId;
84 String systemId;
85 doc = (Document) load("staffNS", builder);
86 domImpl = doc.getImplementation();
87 docType = domImpl.createDocumentType("l2:root", "PUB", "SYS");
88 publicId = docType.getPublicId();
89 systemId = docType.getSystemId();
90 assertEquals("documenttypepublicid01", "PUB", publicId);
91 assertEquals("documenttypesystemid01", "SYS", systemId);
92 }
93
94}
95