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.ozoneDB.xml.dom4j.O3DocumentHelper; 16 17 22 public class TestNormalize extends AbstractTestCase { 23 24 public static void main( String [] args ) { 25 TestRunner.run( suite() ); 26 } 27 28 public static Test suite() { 29 return new TestSuite( TestNormalize.class ); 30 } 31 32 public TestNormalize(String name) { 33 super(name); 34 } 35 36 public void testNormalize() throws Exception { 39 String text = document.asXML(); 40 41 document.normalize(); 42 43 String normalizedText = document.asXML(); 44 45 log( "Initial: " + text ); 46 log( "Normalized: " + normalizedText ); 47 48 String value = document.valueOf( "/dummy/full" ); 49 assertEquals( "Should not trim text", " node ", value ); 50 } 51 52 53 protected void setUp() throws Exception { 56 document = O3DocumentHelper.parseText( 57 "<dummy> <full> node </full> with text <and>another node</and> </dummy>" 58 ); 59 } 60 } 61 62 63 64 65 109 | Popular Tags |