1 /* 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: 5 6 7 8 Copyright (c) 2001 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 15 PURPOSE. 16 17 See W3C License http://www.w3.org/Consortium/Legal/ for more details. 18 19 20 */ 21 22 package tests.org.w3c.dom; 23 24 import dalvik.annotation.TestTargets; 25 import dalvik.annotation.TestLevel; 26 import dalvik.annotation.TestTargetNew; 27 import dalvik.annotation.TestTargetClass; 28 29 import org.w3c.dom.DocumentType; 30 import org.w3c.dom.Document; 31 32 import javax.xml.parsers.DocumentBuilder; 33 34 /** 35 * The "getSystemId()" method of a documenttype node contains the system 36 * identifier associated with the external subset. 37 * 38 * Retrieve the documenttype. Apply the "getSystemId()" method. The string 39 * "staffNS.dtd" should be returned. 40 * 41 * @author NIST 42 * @author Mary Brady 43 * @see <a 44 * 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> 45 */ 46 @TestTargetClass(DocumentType.class) 47 public final class SystemId 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 * 73 * @throws Throwable 74 * Any uncaught exception causes test to fail 75 */ 76 @TestTargetNew( 77 level = TestLevel.COMPLETE, 78 notes = "", 79 method = "getSystemId", 80 args = {} 81 ) 82 public void testGetSystemId() throws Throwable { 83 Document doc; 84 DocumentType docType; 85 String systemId; 86 87 doc = (Document) load("staffNS", builder); 88 docType = doc.getDoctype(); 89 systemId = docType.getSystemId(); 90 assertURIEquals("systemId", null, null, null, "staffNS.dtd", null, 91 null, null, null, systemId); 92 } 93 94 } 95