1 2 /* 3 This Java source file was generated by test-to-java.xsl 4 and is a derived work from the source document. 5 The source document contained the following notice: 6 7 8 9 Copyright (c) 2001 World Wide Web Consortium, 10 (Massachusetts Institute of Technology, Institut National de 11 Recherche en Informatique et en Automatique, Keio University). All 12 Rights Reserved. This program is distributed under the W3C's Software 13 Intellectual Property License. This program is distributed in the 14 hope that it will be useful, but WITHOUT ANY WARRANTY; without even 15 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 16 PURPOSE. 17 18 See W3C License http://www.w3.org/Consortium/Legal/ for more details. 19 20 21 */ 22 23 package tests.org.w3c.dom; 24 25 import dalvik.annotation.TestTargets; 26 import dalvik.annotation.TestLevel; 27 import dalvik.annotation.TestTargetNew; 28 import dalvik.annotation.TestTargetClass; 29 30 import org.w3c.dom.Document; 31 import org.w3c.dom.DocumentType; 32 33 import javax.xml.parsers.DocumentBuilder; 34 35 /** 36 * The "getOwnerDocument()" method returns null if the target 37 * node itself is a DocumentType which is not used with any document yet. 38 * 39 * Invoke the "getOwnerDocument()" method on the master 40 * document. The DocumentType returned should be null. 41 * @author NIST 42 * @author Mary Brady 43 * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc">http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc</a> 44 */ 45 @TestTargetClass(Document.class) 46 public final class OwnerDocument extends DOMTestCase { 47 48 DOMDocumentBuilderFactory factory; 49 50 DocumentBuilder builder; 51 52 protected void setUp() throws Exception { 53 super.setUp(); 54 try { 55 factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory 56 .getConfiguration1()); 57 builder = factory.getBuilder(); 58 } catch (Exception e) { 59 fail("Unexpected exception" + e.getMessage()); 60 } 61 } 62 63 protected void tearDown() throws Exception { 64 factory = null; 65 builder = null; 66 super.tearDown(); 67 } 68 69 /** 70 * Runs the test case. 71 * @throws Throwable Any uncaught exception causes test to fail 72 */ 73 @TestTargetNew( 74 level = TestLevel.PARTIAL, 75 notes = "Dosn't verify that getOwnerDocument can return not null value.", 76 method = "getOwnerDocument", 77 args = {} 78 ) 79 public void testGetOwnerDocument() throws Throwable { 80 Document doc; 81 DocumentType ownerDocument; 82 doc = (Document) load("staff", builder); 83 ownerDocument = (DocumentType) doc.getOwnerDocument(); 84 assertNull("throw_Null", ownerDocument); 85 } 86 87 } 88 89