cvs commit: spice/sandbox/repository/componenthaus/src/tests/org/componenthaus/ant/metadata ComponentMetadataTestCase.java InterfaceMetadataTestCase.java

Mike Hogan <[email protected]>
Newsgroups gmane.comp.java.spice.cvs
Message-ID <[email protected]>
hogie       03/11/03 13:15:30

  Modified:    sandbox/repository/componenthaus/src/tests/org/componenthaus/ant/metadata
                        InterfaceMetadataTestCase.java
  Added:       sandbox/repository/componenthaus/src/tests/org/componenthaus/ant/metadata
                        ComponentMetadataTestCase.java
  Log:
  Can submit more than one interface per jar
  
  Revision  Changes    Path
  1.2       +10 -0     spice/sandbox/repository/componenthaus/src/tests/org/componenthaus/ant/metadata/InterfaceMetadataTestCase.java
  
  Index: InterfaceMetadataTestCase.java
  ===================================================================
  RCS file: /cvsroot/spice/spice/sandbox/repository/componenthaus/src/tests/org/componenthaus/ant/metadata/InterfaceMetadataTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InterfaceMetadataTestCase.java	26 Oct 2003 13:46:42 -0000	1.1
  +++ InterfaceMetadataTestCase.java	3 Nov 2003 21:15:30 -0000	1.2
  @@ -6,6 +6,16 @@
       private static final String firstLineOfJavadoc = "This is the first line of javadoc.";
       private static final String someJavadoc = firstLineOfJavadoc + " This is the second.  This the third.";
   
  +    public void testEquals() {
  +        final InterfaceMetadata intf = new InterfaceMetadata("d","","","");
  +        assertFalse(intf.equals(null));
  +
  +        InterfaceMetadata secondOne = new InterfaceMetadata("d","","","");
  +        assertTrue(intf.equals(secondOne));
  +
  +        assertFalse(intf.equals(new InterfaceMetadata("a","","","")));
  +    }
  +
       public void testCanGetShortDescriptionFromFullJavadoc() {
           final InterfaceMetadata interfaceMetadata = new InterfaceMetadata(null,null,someJavadoc,null);
           assertEquals(firstLineOfJavadoc,interfaceMetadata.getShortDescription());
  
  
  
  1.1                  spice/sandbox/repository/componenthaus/src/tests/org/componenthaus/ant/metadata/ComponentMetadataTestCase.java
  
  Index: ComponentMetadataTestCase.java
  ===================================================================
  package org.componenthaus.ant.metadata;
  
  import junit.framework.TestCase;
  
  public class ComponentMetadataTestCase extends TestCase {
      private ComponentMetadata componentMetadata = null;
  
      protected void setUp() throws Exception {
          componentMetadata = new ComponentMetadata();
      }
  
      public void testEquals() {
          assertFalse(componentMetadata.equals(null));
          assertFalse(componentMetadata.equals(""));
  
          ComponentMetadata secondOne = new ComponentMetadata();
          assertTrue(componentMetadata.equals(secondOne));
  
          final InterfaceMetadata emptyInterfaceMetadata = new InterfaceMetadata("","","","");
          componentMetadata.addInterface(emptyInterfaceMetadata);
          assertFalse(componentMetadata.equals(secondOne));
  
          secondOne.addInterface(emptyInterfaceMetadata);
          assertTrue(componentMetadata.equals(secondOne));
  
          final InterfaceMetadata interfaceMetadata_a = new InterfaceMetadata("a","","","");
          componentMetadata.addInterface(interfaceMetadata_a);
          assertFalse(componentMetadata.equals(secondOne));
  
          InterfaceMetadata interfaceMetadata_b = new InterfaceMetadata("b","","","");
          secondOne.addInterface(interfaceMetadata_b);
          assertFalse(componentMetadata.equals(secondOne));
  
          ComponentMetadata thirdOne = new ComponentMetadata();
          thirdOne.addInterface(emptyInterfaceMetadata);
          thirdOne.addInterface(interfaceMetadata_a);
          assertEquals(componentMetadata,thirdOne);
      }
  
      public void testCanSerializeToAndFromXmlWhenEmpty() {
          final String xml = componentMetadata.toXml();
          final ComponentMetadata reconstituted = ComponentMetadata.fromXml(xml);
          assertEquals(componentMetadata,reconstituted);
      }
  
      public void testCanSerializeToAndFromXmlWhenContainingOneInterface() {
          final InterfaceMetadata emptyInterfaceMetadata = new InterfaceMetadata("","","","");
          componentMetadata.addInterface(emptyInterfaceMetadata);
          assertEquals(componentMetadata,ComponentMetadata.fromXml(componentMetadata.toXml()));
      }
  
      public void testCanSerializeToAndFromXmlWhenContainingTwoInterfaces() {
          final InterfaceMetadata emptyInterfaceMetadata = new InterfaceMetadata("","","","");
          final InterfaceMetadata simpleInterfaceMetadata = new InterfaceMetadata("a","b","c","d");
          componentMetadata.addInterface(emptyInterfaceMetadata);
          componentMetadata.addInterface(simpleInterfaceMetadata);
          assertEquals(componentMetadata,ComponentMetadata.fromXml(componentMetadata.toXml()));
      }
  }
  
  
  


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.