1 9 10 package test.dom4j; 11 12 import junit.framework.Test; 13 import junit.framework.TestSuite; 14 import junit.textui.TestRunner; 15 import org.dom4j.Element; 16 17 23 public class TestIsTextOnly extends AbstractTestCase { 24 25 public static void main( String [] args ) { 26 TestRunner.run( suite() ); 27 } 28 29 public static Test suite() { 30 return new TestSuite( TestIsTextOnly.class ); 31 } 32 33 public TestIsTextOnly(String name) { 34 super(name); 35 } 36 37 public void testDocument() throws Exception { 40 Element root = nodeFactory.createElement( "root" ); 41 Element first = root.addElement( "child" ); 42 first.addText( "This is some text" ); 43 44 assertTrue( "Root node is not text only: " + root, ! root.isTextOnly() ); 45 assertTrue( "First child is text only: " + first, first.isTextOnly() ); 46 } 47 48 } 51 52 53 54 55 99 | Popular Tags |