avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pro...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/configuration/src/test/org/apache/excalibur/configuration/test ConfigurationUtilTestCase.java
Date Fri, 26 Jul 2002 19:19:09 GMT
proyal      2002/07/26 12:19:09

  Modified:    configuration/src/test/org/apache/excalibur/configuration/test
                        ConfigurationUtilTestCase.java
  Log:
  Added test methods for new equals()
  
  Revision  Changes    Path
  1.2       +64 -4     jakarta-avalon-excalibur/configuration/src/test/org/apache/excalibur/configuration/test/ConfigurationUtilTestCase.java
  
  Index: ConfigurationUtilTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/configuration/src/test/org/apache/excalibur/configuration/test/ConfigurationUtilTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConfigurationUtilTestCase.java	13 Jul 2002 18:47:52 -0000	1.1
  +++ ConfigurationUtilTestCase.java	26 Jul 2002 19:19:09 -0000	1.2
  @@ -57,9 +57,9 @@
   import junit.framework.TestCase;
   
   /**
  - * Test the basic public methods of DefaultConfiguration.
  + * Test the ConfigurationUtil class
    *
  - * @author <a href="mailto:rantene@hotmail.com">Ran Tene</a>
  + * @author <a href="mailto:proyal@apache.org">Peter Royal</a>
    */
   public final class ConfigurationUtilTestCase extends TestCase
   {
  @@ -67,7 +67,7 @@
   
       public ConfigurationUtilTestCase()
       {
  -        this( "DefaultConfiguration Test Case" );
  +        this( "ConfigurationUtil Test Case" );
       }
   
       public ConfigurationUtilTestCase( String name )
  @@ -86,7 +86,7 @@
       }
   
       public void testBranch()
  -      throws Exception
  +        throws Exception
       {
           m_configuration.setAttribute( "test", "test" );
           m_configuration.setValue( "test" );
  @@ -98,6 +98,66 @@
           assertEquals( "test", c.getAttribute( "test" ) );
           assertEquals( "test", c.getValue() );
           assertTrue( c.getChild( "test", false ) != null );
  +    }
  +
  +    public void testIdentityEquals()
  +    {
  +        assertTrue( ConfigurationUtil.equals( m_configuration, m_configuration ) );
  +    }
  +
  +    public void testAttributeEquals()
  +    {
  +        DefaultConfiguration c1 = new DefaultConfiguration("a", "here");
  +        DefaultConfiguration c2 = new DefaultConfiguration("a", "there");
  +
  +        c1.setAttribute("test", "test");
  +        c2.setAttribute("test", "test");
  +
  +        assertTrue( ConfigurationUtil.equals( c1, c2 ) );
  +    }
  +
  +    public void testValueEquals()
  +    {
  +        DefaultConfiguration c1 = new DefaultConfiguration("a", "here");
  +        DefaultConfiguration c2 = new DefaultConfiguration("a", "there");
  +
  +        c1.setValue("test");
  +        c2.setValue("test");
  +
  +        assertTrue( ConfigurationUtil.equals( c1, c2 ) );
  +    }
  +
  +    public void testChildrenEquals()
  +    {
  +        DefaultConfiguration c1 = new DefaultConfiguration("a", "here");
  +        DefaultConfiguration k1 = new DefaultConfiguration("b", "wow");
  +        DefaultConfiguration c2 = new DefaultConfiguration("a", "there");
  +        DefaultConfiguration k2 = new DefaultConfiguration("c", "wow");
  +        DefaultConfiguration k3 = new DefaultConfiguration("c", "wow");
  +
  +        k3.setValue( "bigger stronger faster" );
  +
  +        k1.setAttribute("test", "test");
  +        k2.setAttribute("test", "test");
  +
  +        c1.addChild( k1 );
  +        c2.addChild( k2 );
  +
  +        assertTrue( !ConfigurationUtil.equals( c1, c2 ) );
  +
  +        c1.addChild( k2 );
  +        c2.addChild( k1 );
  +
  +        assertTrue( ConfigurationUtil.equals( c1, c2 ) );
  +
  +        c1.addChild( k2 );
  +        c1.addChild( k1 );
  +        c2.addChild( k1 );
  +        c2.addChild( k2 );
  +        c1.addChild( k3 );
  +        c2.addChild( k3 );
  +
  +        assertTrue( ConfigurationUtil.equals( c1, c2 ) );
       }
   }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message