1 7 8 package org.dom4j; 9 10 import junit.textui.TestRunner; 11 12 19 public class IsTextOnlyTest extends AbstractTestCase { 20 public static void main(String [] args) { 21 TestRunner.run(IsTextOnlyTest.class); 22 } 23 24 public void testDocument() throws Exception { 27 DocumentFactory factory = new DocumentFactory(); 28 Element root = factory.createElement("root"); 29 Element first = root.addElement("child"); 30 first.addText("This is some text"); 31 32 assertTrue("Root node is not text only: " + root, !root.isTextOnly()); 33 assertTrue("First child is text only: " + first, first.isTextOnly()); 34 } 35 } 36 37 73 | Popular Tags |