scolebourne    2003/10/02 15:35:31

  Modified:    collections/src/test/org/apache/commons/collections/decorators
                        TestTypedBag.java TestTransformedSortedBag.java
                        TestPredicatedSortedBag.java TestPredicatedBag.java
                        TestTypedSortedBag.java TestTransformedBag.java
               collections/src/test/org/apache/commons/collections
                        TestHashBag.java TestTreeBag.java
               collections/src/test/org/apache/commons/collections/observed
                        TestObservableSortedBag.java TestObservableBag.java
  Added:       collections/src/test/org/apache/commons/collections
                        AbstractTestBag.java AbstractTestSortedBag.java
  Removed:     collections/src/test/org/apache/commons/collections
                        TestBag.java TestSortedBag.java
  Log:
  Rename TestBag to AbstractTestBag
  Rename TestSortedBag to AbstractTestSortedBag
  Javadoc and tidy
  
  Revision  Changes    Path
  1.3       +6 -6      
jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestTypedBag.java
  
  Index: TestTypedBag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestTypedBag.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestTypedBag.java 20 Sep 2003 17:05:36 -0000      1.2
  +++ TestTypedBag.java 2 Oct 2003 22:35:31 -0000       1.3
  @@ -64,7 +64,7 @@
   
   import org.apache.commons.collections.Bag;
   import org.apache.commons.collections.HashBag;
  -import org.apache.commons.collections.TestBag;
  +import org.apache.commons.collections.AbstractTestBag;
   
   /**
    * Extension of [EMAIL PROTECTED] TestBag} for exercising the [EMAIL PROTECTED] 
TypedBag}
  @@ -75,7 +75,7 @@
    * 
    * @author Phil Steitz
    */
  -public class TestTypedBag extends TestBag {
  +public class TestTypedBag extends AbstractTestBag {
       
       public TestTypedBag(String testName) {
           super(testName);
  @@ -100,11 +100,11 @@
           return TypedBag.decorate(bag, claz);
       }
   
  -    public Bag makeBag() {
  +    protected Bag makeBag() {
           return decorateBag(new HashBag(), objectClass);
       }
       
  -    public Bag makeTestBag() {
  +    protected Bag makeTestBag() {
           return decorateBag(new HashBag(), stringClass);
       }
       
  
  
  
  1.3       +5 -5      
jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestTransformedSortedBag.java
  
  Index: TestTransformedSortedBag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestTransformedSortedBag.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestTransformedSortedBag.java     31 Aug 2003 17:28:42 -0000      1.2
  +++ TestTransformedSortedBag.java     2 Oct 2003 22:35:31 -0000       1.3
  @@ -61,7 +61,7 @@
   import junit.framework.TestSuite;
   
   import org.apache.commons.collections.Bag;
  -import org.apache.commons.collections.TestBag;
  +import org.apache.commons.collections.AbstractTestSortedBag;
   import org.apache.commons.collections.TreeBag;
   
   /**
  @@ -73,7 +73,7 @@
    * 
    * @author Stephen Colebourne
    */
  -public class TestTransformedSortedBag extends TestBag {
  +public class TestTransformedSortedBag extends AbstractTestSortedBag {
       
       public TestTransformedSortedBag(String testName) {
           super(testName);
  @@ -88,7 +88,7 @@
           junit.textui.TestRunner.main(testCaseName);
       }
   
  -    public Bag makeBag() {
  +    protected Bag makeBag() {
           return TransformedSortedBag.decorate(new TreeBag(), 
TestTransformedCollection.NOOP_TRANSFORMER);
       }
   
  
  
  
  1.4       +6 -6      
jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestPredicatedSortedBag.java
  
  Index: TestPredicatedSortedBag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestPredicatedSortedBag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestPredicatedSortedBag.java      20 Sep 2003 17:05:36 -0000      1.3
  +++ TestPredicatedSortedBag.java      2 Oct 2003 22:35:31 -0000       1.4
  @@ -66,7 +66,7 @@
   import org.apache.commons.collections.Predicate;
   import org.apache.commons.collections.PredicateUtils;
   import org.apache.commons.collections.SortedBag;
  -import org.apache.commons.collections.TestBag;
  +import org.apache.commons.collections.AbstractTestSortedBag;
   import org.apache.commons.collections.TreeBag;
   
   /**
  @@ -78,7 +78,7 @@
    * 
    * @author Phil Steitz
    */
  -public class TestPredicatedSortedBag extends TestBag {
  +public class TestPredicatedSortedBag extends AbstractTestSortedBag {
       
       private SortedBag emptyBag = new TreeBag();
       private SortedBag nullBag = null;
  @@ -112,11 +112,11 @@
           return PredicatedSortedBag.decorate(bag, predicate);
       }
       
  -    public Bag makeBag() {
  +    protected Bag makeBag() {
           return decorateBag(emptyBag, truePredicate);
       }
       
  -    public Bag makeTestBag() {
  +    protected Bag makeTestBag() {
           return decorateBag(emptyBag, stringPredicate());
       }
       
  
  
  
  1.4       +6 -6      
jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestPredicatedBag.java
  
  Index: TestPredicatedBag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestPredicatedBag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestPredicatedBag.java    20 Sep 2003 17:05:36 -0000      1.3
  +++ TestPredicatedBag.java    2 Oct 2003 22:35:31 -0000       1.4
  @@ -66,7 +66,7 @@
   import org.apache.commons.collections.HashBag;
   import org.apache.commons.collections.Predicate;
   import org.apache.commons.collections.PredicateUtils;
  -import org.apache.commons.collections.TestBag;
  +import org.apache.commons.collections.AbstractTestBag;
   
   /**
    * Extension of [EMAIL PROTECTED] TestBag} for exercising the [EMAIL PROTECTED] 
PredicatedBag}
  @@ -77,7 +77,7 @@
    * 
    * @author Phil Steitz
    */
  -public class TestPredicatedBag extends TestBag {
  +public class TestPredicatedBag extends AbstractTestBag {
       
       public TestPredicatedBag(String testName) {
           super(testName);
  @@ -108,11 +108,11 @@
           return PredicatedBag.decorate(bag, predicate);
       }
   
  -    public Bag makeBag() {
  +    protected Bag makeBag() {
           return decorateBag(new HashBag(), truePredicate);
       }
       
  -    public Bag makeTestBag() {
  +    protected Bag makeTestBag() {
           return decorateBag(new HashBag(), stringPredicate());
       }
       
  
  
  
  1.3       +6 -6      
jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestTypedSortedBag.java
  
  Index: TestTypedSortedBag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestTypedSortedBag.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestTypedSortedBag.java   20 Sep 2003 17:05:36 -0000      1.2
  +++ TestTypedSortedBag.java   2 Oct 2003 22:35:31 -0000       1.3
  @@ -64,7 +64,7 @@
   
   import org.apache.commons.collections.Bag;
   import org.apache.commons.collections.SortedBag;
  -import org.apache.commons.collections.TestBag;
  +import org.apache.commons.collections.AbstractTestSortedBag;
   import org.apache.commons.collections.TreeBag;
   
   /**
  @@ -76,7 +76,7 @@
    * 
    * @author Phil Steitz
    */
  -public class TestTypedSortedBag extends TestBag {
  +public class TestTypedSortedBag extends AbstractTestSortedBag {
          
       public TestTypedSortedBag(String testName) {
           super(testName);
  @@ -103,11 +103,11 @@
           return TypedSortedBag.decorate(bag, claz);
       }
   
  -    public Bag makeBag() {
  +    protected Bag makeBag() {
           return decorateBag(emptyBag, objectClass);
       }
       
  -    public Bag makeTestBag() {
  +    protected Bag makeTestBag() {
           return decorateBag(emptyBag, stringClass);
       }
       
  
  
  
  1.3       +5 -5      
jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestTransformedBag.java
  
  Index: TestTransformedBag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestTransformedBag.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestTransformedBag.java   31 Aug 2003 17:28:42 -0000      1.2
  +++ TestTransformedBag.java   2 Oct 2003 22:35:31 -0000       1.3
  @@ -62,7 +62,7 @@
   
   import org.apache.commons.collections.Bag;
   import org.apache.commons.collections.HashBag;
  -import org.apache.commons.collections.TestBag;
  +import org.apache.commons.collections.AbstractTestBag;
   
   /**
    * Extension of [EMAIL PROTECTED] TestBag} for exercising the [EMAIL PROTECTED] 
TransformedBag}
  @@ -73,7 +73,7 @@
    * 
    * @author Stephen Colebourne
    */
  -public class TestTransformedBag extends TestBag {
  +public class TestTransformedBag extends AbstractTestBag {
       
       public TestTransformedBag(String testName) {
           super(testName);
  @@ -88,7 +88,7 @@
           junit.textui.TestRunner.main(testCaseName);
       }
   
  -    public Bag makeBag() {
  +    protected Bag makeBag() {
           return TransformedBag.decorate(new HashBag(), 
TestTransformedCollection.NOOP_TRANSFORMER);
       }
   
  
  
  
  1.5       +24 -25    
jakarta-commons/collections/src/test/org/apache/commons/collections/TestHashBag.java
  
  Index: TestHashBag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestHashBag.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestHashBag.java  20 Sep 2003 17:02:03 -0000      1.4
  +++ TestHashBag.java  2 Oct 2003 22:35:31 -0000       1.5
  @@ -1,13 +1,10 @@
   /*
    * $Header$
  - * $Revision$
  - * $Date$
  - *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -36,7 +33,7 @@
    *
    * 5. Products derived from this software may not be called "Apache"
    *    nor may "Apache" appear in their names without prior written
  - *    permission of the Apache Group.
  + *    permission of the Apache Software Foundation.
    *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  @@ -68,23 +65,25 @@
    * implementation.
    *
    * @author Chuck Burdick
  - * @version $Id$ */
  -public class TestHashBag extends TestBag {
  -   public TestHashBag(String testName) {
  -      super(testName);
  -   }
  -
  -   public static Test suite() {
  -      return new TestSuite(TestHashBag.class);
  -   }
  -
  -   public static void main(String args[]) {
  -      String[] testCaseName = { TestHashBag.class.getName() };
  -      junit.textui.TestRunner.main(testCaseName);
  -   }
  -
  -   public Bag makeBag() {
  -      return new HashBag();
  -   }
  + * @version $Id$
  + */
  +public class TestHashBag extends AbstractTestBag {
  +    
  +    public TestHashBag(String testName) {
  +        super(testName);
  +    }
  +
  +    public static Test suite() {
  +        return new TestSuite(TestHashBag.class);
  +    }
  +
  +    public static void main(String args[]) {
  +        String[] testCaseName = { TestHashBag.class.getName()};
  +        junit.textui.TestRunner.main(testCaseName);
  +    }
  +
  +    protected Bag makeBag() {
  +        return new HashBag();
  +    }
  +    
   }
  -
  
  
  
  1.5       +8 -13     
jakarta-commons/collections/src/test/org/apache/commons/collections/TestTreeBag.java
  
  Index: TestTreeBag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestTreeBag.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestTreeBag.java  20 Sep 2003 17:02:03 -0000      1.4
  +++ TestTreeBag.java  2 Oct 2003 22:35:31 -0000       1.5
  @@ -68,8 +68,10 @@
    * implementation.
    *
    * @author Chuck Burdick
  - * @version $Id$ */
  -public class TestTreeBag extends TestBag {
  + * @version $Id$
  + */
  +public class TestTreeBag extends AbstractTestBag {
  +    
      public TestTreeBag(String testName) {
         super(testName);
      }
  @@ -83,7 +85,7 @@
         junit.textui.TestRunner.main(testCaseName);
      }
   
  -   public Bag makeBag() {
  +   protected Bag makeBag() {
         return new TreeBag();
      }
   
  @@ -110,10 +112,3 @@
                      "D", ((SortedBag)bag).last());
      }
   }
  -
  -
  -
  -
  -
  -
  -
  
  
  
  1.1                  
jakarta-commons/collections/src/test/org/apache/commons/collections/AbstractTestBag.java
  
  Index: AbstractTestBag.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/AbstractTestBag.java,v
 1.1 2003/10/02 22:35:31 scolebourne Exp $
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowledgement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgement may appear in the software itself,
   *    if and wherever such third-party acknowledgements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.collections;
  
  import java.util.ArrayList;
  import java.util.ConcurrentModificationException;
  import java.util.Iterator;
  import java.util.List;
  
  /**
   * Abstract test class for [EMAIL PROTECTED] Bag} methods and contracts.
   * <p>
   * To use, simply extend this class, and implement
   * the [EMAIL PROTECTED] #makeBag} method.
   * <p>
   * If your [EMAIL PROTECTED] Bag} fails one of these tests by design,
   * you may still use this base set of cases.  Simply override the
   * test case (method) your [EMAIL PROTECTED] Bag} fails.
   *
   * @author Chuck Burdick
   * @version $Id: AbstractTestBag.java,v 1.1 2003/10/02 22:35:31 scolebourne Exp $
   */
  public abstract class AbstractTestBag extends AbstractTestObject {
  //  TODO: this class should really extend from TestCollection, but the bag
  //  implementations currently do not conform to the Collection interface.  Once
  //  those are fixed or at least a strategy is made for resolving the issue, this
  //  can be changed back to extend TestCollection instead.
  
      /**
       * JUnit constructor.
       * 
       * @param testName  the test class name
       */
      public AbstractTestBag(String testName) {
          super(testName);
      }
  
      //-----------------------------------------------------------------------
      /**
       * Return a new, empty [EMAIL PROTECTED] Bag} to used for testing.
       * 
       * @return the bag to be tested
       */
      protected abstract Bag makeBag();
  
      /**
       * Implements the superclass method to return the Bag.
       * 
       * @return the bag to be tested
       */
      protected Object makeObject() {
          return makeBag();
      }
  
      //-----------------------------------------------------------------------
      public void testBagAdd() {
          Bag bag = makeBag();
          bag.add("A");
          assertTrue("Should contain 'A'", bag.contains("A"));
          assertEquals("Should have count of 1", 1, bag.getCount("A"));
          bag.add("A");
          assertTrue("Should contain 'A'", bag.contains("A"));
          assertEquals("Should have count of 2", 2, bag.getCount("A"));
          bag.add("B");
          assertTrue(bag.contains("A"));
          assertTrue(bag.contains("B"));
      }
  
      public void testBagEqualsSelf() {
          Bag bag = makeBag();
          assertTrue(bag.equals(bag));
          bag.add("elt");
          assertTrue(bag.equals(bag));
          bag.add("elt"); // again
          assertTrue(bag.equals(bag));
          bag.add("elt2");
          assertTrue(bag.equals(bag));
      }
  
      public void testRemove() {
          Bag bag = makeBag();
          bag.add("A");
          assertEquals("Should have count of 1", 1, bag.getCount("A"));
          bag.remove("A");
          assertEquals("Should have count of 0", 0, bag.getCount("A"));
          bag.add("A");
          bag.add("A");
          bag.add("A");
          bag.add("A");
          assertEquals("Should have count of 4", 4, bag.getCount("A"));
          bag.remove("A", 0);
          assertEquals("Should have count of 4", 4, bag.getCount("A"));
          bag.remove("A", 2);
          assertEquals("Should have count of 2", 2, bag.getCount("A"));
          bag.remove("A");
          assertEquals("Should have count of 0", 0, bag.getCount("A"));
      }
  
      public void testRemoveAll() {
          Bag bag = makeBag();
          bag.add("A", 2);
          assertEquals("Should have count of 2", 2, bag.getCount("A"));
          bag.add("B");
          bag.add("C");
          assertEquals("Should have count of 4", 4, bag.size());
          List delete = new ArrayList();
          delete.add("A");
          delete.add("B");
          bag.removeAll(delete);
          assertEquals("Should have count of 1", 1, bag.getCount("A"));
          assertEquals("Should have count of 0", 0, bag.getCount("B"));
          assertEquals("Should have count of 1", 1, bag.getCount("C"));
          assertEquals("Should have count of 2", 2, bag.size());
      }
      
      public void testContains() {
          Bag bag = makeBag();
          bag.add("A");
          bag.add("A");
          bag.add("A");
          bag.add("B");
          bag.add("B");
          List compare = new ArrayList();
          compare.add("A");
          compare.add("B");
          assertEquals("Other list has 1 'B'", 1, (new 
HashBag(compare)).getCount("B"));
          assertTrue("Bag has at least 1 'B'", 1 <= bag.getCount("B"));
          assertTrue("Bag contains items in the list", bag.containsAll(compare));
          compare.add("A");
          compare.add("B");
          assertEquals("Other list has 2 'B'", 2, (new 
HashBag(compare)).getCount("B"));
          assertTrue("Bag has at least 2 'B'", 2 <= bag.getCount("B"));
          assertTrue("Bag contains items in the list", bag.containsAll(compare));
          compare.add("A");
          compare.add("B");
          assertEquals("Other list has 3 'B'", 3, (new 
HashBag(compare)).getCount("B"));
          assertTrue("Bag does not have 3 'B'", 3 > bag.getCount("B"));
          assertTrue("Bag contains items in the list", !bag.containsAll(compare));
      }
  
      public void testSize() {
          Bag bag = makeBag();
          bag.add("A");
          bag.add("A");
          bag.add("A");
          bag.add("B");
          bag.add("B");
          assertEquals("Should have 5 total items", 5, bag.size());
          bag.remove("A", 2);
          assertEquals("Should have 1 'A'", 1, bag.getCount("A"));
          assertEquals("Should have 3 total items", 3, bag.size());
          bag.remove("B");
          assertEquals("Should have 1 total item", 1, bag.size());
      }
      
      public void testRetainAll() {
          Bag bag = makeBag();
          bag.add("A");
          bag.add("A");
          bag.add("A");
          bag.add("B");
          bag.add("B");
          bag.add("C");
          List retains = new ArrayList();
          retains.add("B");
          retains.add("C");
          bag.retainAll(retains);
          assertEquals("Should have 2 total items", 2, bag.size());
      }
  
      public void testIterator() {
          Bag bag = makeBag();
          bag.add("A");
          bag.add("A");
          bag.add("B");
          assertEquals("Bag should have 3 items", 3, bag.size());
          Iterator i = bag.iterator();
      
          boolean foundA = false;
          while (i.hasNext()) {
              String element = (String) i.next();
              // ignore the first A, remove the second via Iterator.remove()
              if (element.equals("A")) {
                  if (foundA == false) {
                      foundA = true;
                  } else {
                      i.remove();
                  }
              }
          }
      
          assertTrue("Bag should still contain 'A'", bag.contains("A"));
          assertEquals("Bag should have 2 items", 2, bag.size());
          assertEquals("Bag should have 1 'A'", 1, bag.getCount("A"));
      }
  
      public void testIteratorFail() {
          Bag bag = makeBag();
          bag.add("A");
          bag.add("A");
          bag.add("B");
          Iterator i = bag.iterator();
          i.next();
          bag.remove("A");
          try {
              i.next();
              fail("Should throw ConcurrentModificationException");
          } catch (ConcurrentModificationException e) {
              // expected
          }
      }
      
  }
  
  
  
  1.1                  
jakarta-commons/collections/src/test/org/apache/commons/collections/AbstractTestSortedBag.java
  
  Index: AbstractTestSortedBag.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/AbstractTestSortedBag.java,v
 1.1 2003/10/02 22:35:31 scolebourne Exp $
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowledgement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgement may appear in the software itself,
   *    if and wherever such third-party acknowledgements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.collections;
  
  /**
   * Abstract test class for [EMAIL PROTECTED] java.util.SortedBag} methods and 
contracts.
   *
   * @since Commons Collections 3.0
   * @version $Revision: 1.1 $ $Date: 2003/10/02 22:35:31 $
   * 
   * @author Stephen Colebourne
   */
  public abstract class AbstractTestSortedBag extends AbstractTestBag {
  
      public AbstractTestSortedBag(String testName) {
          super(testName);
      }
      
      // TODO: Add the SortedBag tests!
  }
  
  
  
  1.2       +5 -5      
jakarta-commons/collections/src/test/org/apache/commons/collections/observed/TestObservableSortedBag.java
  
  Index: TestObservableSortedBag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/observed/TestObservableSortedBag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestObservableSortedBag.java      28 Sep 2003 21:50:37 -0000      1.1
  +++ TestObservableSortedBag.java      2 Oct 2003 22:35:31 -0000       1.2
  @@ -61,7 +61,7 @@
   import junit.framework.TestSuite;
   
   import org.apache.commons.collections.Bag;
  -import org.apache.commons.collections.TestSortedBag;
  +import org.apache.commons.collections.AbstractTestSortedBag;
   import org.apache.commons.collections.TreeBag;
   
   /**
  @@ -73,7 +73,7 @@
    * 
    * @author Stephen Colebourne
    */
  -public class TestObservableSortedBag extends TestSortedBag implements 
ObservedTestHelper.ObservedFactory {
  +public class TestObservableSortedBag extends AbstractTestSortedBag implements 
ObservedTestHelper.ObservedFactory {
       
       public TestObservableSortedBag(String testName) {
           super(testName);
  @@ -89,7 +89,7 @@
       }
   
       //-----------------------------------------------------------------------
  -    public Bag makeBag() {
  +    protected Bag makeBag() {
           return ObservableSortedBag.decorate(new TreeBag(), 
ObservedTestHelper.LISTENER);
       }
   
  
  
  
  1.2       +5 -5      
jakarta-commons/collections/src/test/org/apache/commons/collections/observed/TestObservableBag.java
  
  Index: TestObservableBag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/observed/TestObservableBag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestObservableBag.java    21 Sep 2003 20:01:53 -0000      1.1
  +++ TestObservableBag.java    2 Oct 2003 22:35:31 -0000       1.2
  @@ -62,7 +62,7 @@
   
   import org.apache.commons.collections.Bag;
   import org.apache.commons.collections.HashBag;
  -import org.apache.commons.collections.TestBag;
  +import org.apache.commons.collections.AbstractTestBag;
   
   /**
    * Extension of [EMAIL PROTECTED] TestBag} for exercising the
  @@ -73,7 +73,7 @@
    * 
    * @author Stephen Colebourne
    */
  -public class TestObservableBag extends TestBag implements 
ObservedTestHelper.ObservedFactory {
  +public class TestObservableBag extends AbstractTestBag implements 
ObservedTestHelper.ObservedFactory {
       
       public TestObservableBag(String testName) {
           super(testName);
  @@ -89,7 +89,7 @@
       }
   
       //-----------------------------------------------------------------------
  -    public Bag makeBag() {
  +    protected Bag makeBag() {
           return ObservableBag.decorate(new HashBag(), ObservedTestHelper.LISTENER);
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to