src/test/java/org/jboss/test/util/test/propertyeditor/PropertyEditorsUnitTestCase.java
/** 
    * Tests the DOM Document and Element editors.
    */
Tests the DOM Document and Element editors.
Tests the DOM Document and Element editors .
public void testDocumentElementEditors()
   {
      log.debug("+++ testDocumentElementEditors");
      DocumentEditor de = new DocumentEditor();
      String s = "<!-- header comment --><doc name='whatever'/><!-- footer comment -->";
      log.debug("setAsText '" + s + "'");
      de.setAsText(s);
      log.debug("Parsed XML document:");
      log((Node)de.getValue(), "  ");
      log.debug("getAsText '" + de.getAsText() + "'");
      assertTrue("Document :\n" + de.getAsText(), de.getAsText().trim().endsWith(s));
      assertTrue(de.getValue() instanceof org.w3c.dom.Document);
      s = "<element>\n\n<e2/> testing\n\n</element>";
      de.setAsText(s);
      assertTrue("Document :\n" + de.getAsText() + "\nvs\n" + s, de.getAsText().trim().endsWith(s));
      ElementEditor ee = new ElementEditor();
      s = "<element>text</element>";
      ee.setAsText(s);
      assertEquals(s, ee.getAsText());
      assertTrue(ee.getValue() instanceof org.w3c.dom.Element);
   }
public void testDocumentElementEditors ( ) { log . debug ( "+++ testDocumentElementEditors" ) ; DocumentEditor de = new DocumentEditor ( ) ; String s = "<!-- header comment --><doc name='whatever'/><!-- footer comment -->" ; log . debug ( "setAsText '" + s + "'" ) ; de . setAsText ( s ) ; log . debug ( "Parsed XML document:" ) ; log ( ( Node ) de . getValue ( ) , "  " ) ; log . debug ( "getAsText '" + de . getAsText ( ) + "'" ) ; assertTrue ( "Document :\n" + de . getAsText ( ) , de . getAsText ( ) . trim ( ) . endsWith ( s ) ) ; assertTrue ( de . getValue ( ) instanceof org . w3c . dom . Document ) ; s = "<element>\n\n<e2/> testing\n\n</element>" ; de . setAsText ( s ) ; assertTrue ( "Document :\n" + de . getAsText ( ) + "\nvs\n" + s , de . getAsText ( ) . trim ( ) . endsWith ( s ) ) ; ElementEditor ee = new ElementEditor ( ) ; s = "<element>text</element>" ; ee . setAsText ( s ) ; assertEquals ( s , ee . getAsText ( ) ) ; assertTrue ( ee . getValue ( ) instanceof org . w3c . dom . Element ) ; }
Tests the DOM Document and Element editors.
Tests the DOM Document and Element editors .
// Comments can appear outside of a document // Test whitespace preservation