You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by pr...@apache.org on 2002/05/23 21:00:42 UTC

cvs commit: jakarta-avalon/src/test/org/apache/avalon/framework/configuration/test SAXConfigurationHandlerTestCase.java

proyal      02/05/23 12:00:42

  Modified:    src/test/org/apache/avalon/framework/configuration/test
                        SAXConfigurationHandlerTestCase.java
  Log:
  Added testcase for proper handling of empty elements and defaults
  
  Revision  Changes    Path
  1.10      +8 -0      jakarta-avalon/src/test/org/apache/avalon/framework/configuration/test/SAXConfigurationHandlerTestCase.java
  
  Index: SAXConfigurationHandlerTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/test/org/apache/avalon/framework/configuration/test/SAXConfigurationHandlerTestCase.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SAXConfigurationHandlerTestCase.java	11 Dec 2001 09:00:47 -0000	1.9
  +++ SAXConfigurationHandlerTestCase.java	23 May 2002 19:00:42 -0000	1.10
  @@ -38,6 +38,7 @@
        * <pre>
        *   &lt;rawName attqName="attValue"&gt;
        *     &lt;child:localName xmlns:child="namespaceURI"&gt;value&lt;/child:localName&gt;
  +     *     &lt;emptyElement/&gt;
        *   &lt;/rawName&gt;
        * </pre>
        */
  @@ -54,6 +55,10 @@
           final String childvalue = "value";
           final String attqName = "attqName";
           final String attValue = "attValue";
  +        final String emptylocal = "emptyElement";
  +        final String emptyraw = emptylocal;
  +        
  +        final AttributesImpl emptyAttributes  = new AttributesImpl();
   
           final AttributesImpl attributes  = new AttributesImpl();
           attributes.addAttribute("",attqName,attqName,
  @@ -72,6 +77,8 @@
   
           handler.characters( childvalue.toCharArray(), 0, childvalue.length() );
           handler.endElement( childURI, childlocal, childraw );
  +        handler.startElement( rootURI, emptylocal, emptyraw, emptyAttributes );
  +        handler.endElement( rootURI, emptylocal, emptyraw );
           handler.endElement( null, null, rootraw);
           handler.endPrefixMapping( "child" );
           handler.endDocument();
  @@ -81,6 +88,7 @@
           assertEquals( childvalue, configuration.getChild(childraw).getValue());
           assertEquals( "", configuration.getChild(childraw).getNamespace() );
           assertEquals( rootraw, configuration.getName());
  +        assertEquals( "test", configuration.getChild(emptyraw).getValue( "test" ) );
       }
   
       public void testNamespaceHandling() throws Exception
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>