rwaldhoff    2003/02/26 11:17:24

  Modified:    collections/src/java/org/apache/commons/collections/primitives
                        AbstractRandomAccessIntList.java
               collections/src/java/org/apache/commons/collections/primitives/adapters
                        CollectionIntCollection.java
                        IntCollectionCollection.java IntListList.java
                        ListIntList.java
               collections/src/test/org/apache/commons/collections/primitives
                        TestAll.java TestArrayIntList.java
                        TestArrayUnsignedShortList.java TestIntList.java
  Added:       collections/src/test/org/apache/commons/collections/primitives/adapters
                        TestAll.java TestIntListList.java
                        TestListIntList.java
  Log:
  * add tests
  * support serializable
  * tweak equals contract to match List.equals better
  
  Revision  Changes    Path
  1.11      +6 -5      
jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractRandomAccessIntList.java
  
  Index: AbstractRandomAccessIntList.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractRandomAccessIntList.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AbstractRandomAccessIntList.java  13 Jan 2003 23:07:08 -0000      1.10
  +++ AbstractRandomAccessIntList.java  26 Feb 2003 19:17:22 -0000      1.11
  @@ -57,6 +57,7 @@
   
   package org.apache.commons.collections.primitives;
   
  +import java.io.Serializable;
   import java.util.ConcurrentModificationException;
   import java.util.NoSuchElementException;
   
  @@ -78,7 +79,7 @@
    * 
    * @author Rodney Waldhoff 
    */
  -public abstract class AbstractRandomAccessIntList extends AbstractIntCollection 
implements IntList {
  +public abstract class AbstractRandomAccessIntList extends AbstractIntCollection 
implements IntList, Serializable {
   
       // constructors
       //-------------------------------------------------------------------------
  @@ -250,7 +251,7 @@
       // inner classes
       //-------------------------------------------------------------------------
       
  -    private static class ComodChecker {
  +    private static class ComodChecker implements Serializable {
           ComodChecker(AbstractRandomAccessIntList source) {
               _source = source;  
               resyncModCount();             
  @@ -367,7 +368,7 @@
           private int _lastReturnedIndex = -1;        
       }   
   
  -    protected static class RandomAccessIntSubList extends 
AbstractRandomAccessIntList implements IntList {
  +    protected static class RandomAccessIntSubList extends 
AbstractRandomAccessIntList implements IntList, Serializable {
           RandomAccessIntSubList(AbstractRandomAccessIntList list, int fromIndex, int 
toIndex) {
               if(fromIndex < 0 || toIndex > list.size() || fromIndex > toIndex) {
                   throw new IndexOutOfBoundsException();
  
  
  
  1.4       +10 -3     
jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/CollectionIntCollection.java
  
  Index: CollectionIntCollection.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/CollectionIntCollection.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CollectionIntCollection.java      13 Jan 2003 21:52:28 -0000      1.3
  +++ CollectionIntCollection.java      26 Feb 2003 19:17:23 -0000      1.4
  @@ -57,6 +57,7 @@
   
   package org.apache.commons.collections.primitives.adapters;
   
  +import java.io.Serializable;
   import java.util.Collection;
   
   import org.apache.commons.collections.primitives.IntCollection;
  @@ -75,7 +76,7 @@
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff 
    */
  -public class CollectionIntCollection implements IntCollection {
  +public class CollectionIntCollection implements IntCollection, Serializable {
       /**
        * Create an [EMAIL PROTECTED] IntCollection IntCollection} wrapping
        * the specified [EMAIL PROTECTED] Collection Collection}.  When
  @@ -91,6 +92,12 @@
           return null == collection ? null : new CollectionIntCollection(collection);
       }
       
  +    /**
  +     * No-arg constructor, for serialization purposes.
  +     */
  +    protected CollectionIntCollection() {
  +    }
  +
       /**
        * Creates an [EMAIL PROTECTED] IntCollection IntCollection} wrapping
        * the specified [EMAIL PROTECTED] Collection Collection}.
  
  
  
  1.4       +10 -3     
jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/IntCollectionCollection.java
  
  Index: IntCollectionCollection.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/IntCollectionCollection.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- IntCollectionCollection.java      13 Jan 2003 21:52:28 -0000      1.3
  +++ IntCollectionCollection.java      26 Feb 2003 19:17:23 -0000      1.4
  @@ -57,6 +57,7 @@
   
   package org.apache.commons.collections.primitives.adapters;
   
  +import java.io.Serializable;
   import java.lang.reflect.Array;
   import java.util.Collection;
   import java.util.Iterator;
  @@ -76,7 +77,7 @@
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff 
    */
  -public class IntCollectionCollection implements Collection {
  +public class IntCollectionCollection implements Collection, Serializable {
       
       /**
        * Create a [EMAIL PROTECTED] Collection Collection} wrapping
  @@ -94,6 +95,12 @@
           return null == collection ? null : new IntCollectionCollection(collection);
       }
       
  +    /**
  +     * No-arg constructor, for serialization purposes.
  +     */
  +    protected IntCollectionCollection() {
  +    }
  +
       /**
        * Creates a [EMAIL PROTECTED] Collection Collection} wrapping
        * the specified [EMAIL PROTECTED] IntCollection IntCollection}.
  
  
  
  1.4       +30 -19    
jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/IntListList.java
  
  Index: IntListList.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/IntListList.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- IntListList.java  13 Jan 2003 21:52:28 -0000      1.3
  +++ IntListList.java  26 Feb 2003 19:17:23 -0000      1.4
  @@ -57,7 +57,9 @@
   
   package org.apache.commons.collections.primitives.adapters;
   
  +import java.io.Serializable;
   import java.util.Collection;
  +import java.util.Iterator;
   import java.util.List;
   import java.util.ListIterator;
   
  @@ -75,7 +77,7 @@
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff 
    */
  -public class IntListList extends IntCollectionCollection implements List {
  +public class IntListList extends IntCollectionCollection implements List, 
Serializable {
       
       /**
        * Create a [EMAIL PROTECTED] List List} wrapping
  @@ -94,6 +96,12 @@
       }
   
       /**
  +     * No-arg constructor, for serialization purposes.
  +     */
  +    protected IntListList() {
  +    }
  +    
  +    /**
        * Creates a [EMAIL PROTECTED] List List} wrapping
        * the specified [EMAIL PROTECTED] IntList IntList}.
        * @see #wrap
  @@ -157,24 +165,27 @@
           return IntListList.wrap(_list.subList(fromIndex,toIndex));
       }
   
  -    /**
  -     * If <i>that</i> is a [EMAIL PROTECTED] List List}, 
  -     * it is [EMAIL PROTECTED] ListIntList#wrap wrapped} and
  -     * compared to my underlying 
  -     * [EMAIL PROTECTED] org.apache.commons.collections.primitives.IntList IntList},
  -     * otherwise this method simply delegates to my parent implementation.
  -     */
  -    public boolean equals(Object that) {
  -        if(that instanceof List) {
  -            try {
  -                return _list.equals(ListIntList.wrap((List)that));
  -            } catch(NullPointerException e) {
  -                return false;
  -            } catch(ClassCastException e) {
  -                return false;
  +    public boolean equals(Object obj) {
  +        if(obj instanceof List) {
  +            List that = (List)obj;
  +            if(this == that) {
  +                return true;
  +            } else if(this.size() != that.size()) {
  +                return false;            
  +            } else {
  +                Iterator thisiter = iterator();
  +                Iterator thatiter = that.iterator();
  +                while(thisiter.hasNext()) {
  +                    Object thiselt = thisiter.next();
  +                    Object thatelt = thatiter.next();
  +                    if(null == thiselt ? null != thatelt : 
!(thiselt.equals(thatelt))) {
  +                        return false;
  +                    }
  +                }
  +                return true;
               }
           } else {
  -            return super.equals(that);
  +            return false;
           }
       }
       
  
  
  
  1.5       +29 -14    
jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/ListIntList.java
  
  Index: ListIntList.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/ListIntList.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ListIntList.java  13 Jan 2003 21:52:28 -0000      1.4
  +++ ListIntList.java  26 Feb 2003 19:17:23 -0000      1.5
  @@ -57,9 +57,11 @@
   
   package org.apache.commons.collections.primitives.adapters;
   
  +import java.io.Serializable;
   import java.util.List;
   
   import org.apache.commons.collections.primitives.IntCollection;
  +import org.apache.commons.collections.primitives.IntIterator;
   import org.apache.commons.collections.primitives.IntList;
   import org.apache.commons.collections.primitives.IntListIterator;
   
  @@ -75,7 +77,7 @@
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff 
    */
  -public class ListIntList extends CollectionIntCollection implements IntList {
  +public class ListIntList extends CollectionIntCollection implements IntList, 
Serializable {
       
       /**
        * Create an [EMAIL PROTECTED] IntList IntList} wrapping
  @@ -94,6 +96,12 @@
       }
   
       /**
  +     * No-arg constructor, for serialization purposes.
  +     */
  +    protected ListIntList() {
  +    }
  +
  +    /**
        * Creates an [EMAIL PROTECTED] IntList IntList} wrapping
        * the specified [EMAIL PROTECTED] List List}.
        * @see #wrap
  @@ -157,18 +165,25 @@
           return ListIntList.wrap(_list.subList(fromIndex,toIndex));
       }
   
  -    /**
  -     * If <i>that</i> is an [EMAIL PROTECTED] IntList IntList}, 
  -     * it is [EMAIL PROTECTED] IntListList#wrap wrapped} and
  -     * compared to my underlying 
  -     * [EMAIL PROTECTED] List List},
  -     * otherwise this method simply delegates to my parent implementation.
  -     */
  -    public boolean equals(Object that) {
  -        if(that instanceof IntList) {
  -            return _list.equals(IntListList.wrap((IntList)that));
  +    public boolean equals(Object obj) {
  +        if(obj instanceof IntList) {
  +            IntList that = (IntList)obj;
  +            if(this == that) {
  +                return true;
  +            } else if(this.size() != that.size()) {
  +                return false;            
  +            } else {
  +                IntIterator thisiter = iterator();
  +                IntIterator thatiter = that.iterator();
  +                while(thisiter.hasNext()) {
  +                    if(thisiter.next() != thatiter.next()) {
  +                        return false;
  +                    }
  +                }
  +                return true;
  +            }
           } else {
  -            return super.equals(that);
  +            return false;
           }
       }
           
  
  
  
  1.8       +4 -2      
jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestAll.java
  
  Index: TestAll.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestAll.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestAll.java      12 Jan 2003 15:23:20 -0000      1.7
  +++ TestAll.java      26 Feb 2003 19:17:23 -0000      1.8
  @@ -80,6 +80,8 @@
           
           suite.addTest(TestArrayIntList.suite());
           suite.addTest(TestArrayUnsignedShortList.suite());
  +
  +        
suite.addTest(org.apache.commons.collections.primitives.adapters.TestAll.suite());
           
           suite.addTest(TestUnsignedByteArrayList.suite());
           suite.addTest(TestShortArrayList.suite());
  
  
  
  1.8       +12 -7     
jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestArrayIntList.java
  
  Index: TestArrayIntList.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestArrayIntList.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestArrayIntList.java     26 Feb 2003 15:45:19 -0000      1.7
  +++ TestArrayIntList.java     26 Feb 2003 19:17:23 -0000      1.8
  @@ -76,7 +76,8 @@
       }
   
       public static Test suite() {
  -        TestSuite suite = BulkTest.makeSuite(TestArrayIntList.class);
  +        //TestSuite suite = BulkTest.makeSuite(TestArrayIntList.class);
  +        TestSuite suite = new TestSuite(TestArrayIntList.class);
           return suite;
       }
   
  @@ -90,24 +91,28 @@
       // tests
       // ------------------------------------------------------------------------
   
  +    /** @todo need to add serialized form to cvs */
       public void testCanonicalEmptyCollectionExists() {
           // XXX FIX ME XXX
  -        // need to a serialized form to cvs
  +        // need to add a serialized form to cvs
       }
   
  +    /** @todo need to add serialized form to cvs */
       public void testCanonicalFullCollectionExists() {
           // XXX FIX ME XXX
  -        // need to a serialized form to cvs
  +        // need to add a serialized form to cvs
       }
   
  +    /** @todo need to add serialized form to cvs */
       public void testEmptyListCompatibility() {
           // XXX FIX ME XXX
  -        // need to a serialized form to cvs
  +        // need to add a serialized form to cvs
       }
   
  +    /** @todo need to add serialized form to cvs */
       public void testFullListCompatibility() {
           // XXX FIX ME XXX
  -        // need to a serialized form to cvs
  +        // need to add a serialized form to cvs
       }
   
       public void testAddGetLargeValues() {
  
  
  
  1.8       +13 -8     
jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestArrayUnsignedShortList.java
  
  Index: TestArrayUnsignedShortList.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestArrayUnsignedShortList.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestArrayUnsignedShortList.java   26 Feb 2003 15:45:19 -0000      1.7
  +++ TestArrayUnsignedShortList.java   26 Feb 2003 19:17:23 -0000      1.8
  @@ -76,8 +76,9 @@
       }
   
       public static Test suite() {
  -        TestSuite suite = BulkTest.makeSuite(TestArrayUnsignedShortList.class);
  -        return suite;
  +        //TestSuite suite = BulkTest.makeSuite(TestArrayUnsignedShortList.class);
  +        //return suite;
  +        return new TestSuite(TestArrayUnsignedShortList.class);
       }
   
       // collections testing framework
  @@ -90,24 +91,28 @@
       // tests
       // ------------------------------------------------------------------------
   
  +    /** @todo need to add serialized form to cvs */
       public void testCanonicalEmptyCollectionExists() {
           // XXX FIX ME XXX
  -        // need to a serialized form to cvs
  +        // need to add a serialized form to cvs
       }
   
  +    /** @todo need to add serialized form to cvs */
       public void testCanonicalFullCollectionExists() {
           // XXX FIX ME XXX
  -        // need to a serialized form to cvs
  +        // need to add a serialized form to cvs
       }
   
  +    /** @todo need to add serialized form to cvs */
       public void testEmptyListCompatibility() {
           // XXX FIX ME XXX
  -        // need to a serialized form to cvs
  +        // need to add a serialized form to cvs
       }
   
  +    /** @todo need to add serialized form to cvs */
       public void testFullListCompatibility() {
           // XXX FIX ME XXX
  -        // need to a serialized form to cvs
  +        // need to add a serialized form to cvs
       }
   
       public void testZeroInitialCapacityIsValid() {
  
  
  
  1.5       +4 -4      
jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestIntList.java
  
  Index: TestIntList.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestIntList.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestIntList.java  26 Feb 2003 15:45:19 -0000      1.4
  +++ TestIntList.java  26 Feb 2003 19:17:23 -0000      1.5
  @@ -193,8 +193,8 @@
           IntList ilist = makeEmptyIntList();
           List list = new ArrayList();
           
  -        assertTrue("Unwrapped, empty List is not equal to empty 
IntList.",!ilist.equals(list));
  -        assertTrue("Unwrapped, empty IntList is not equal to empty 
List.",!list.equals(ilist));
  +        assertTrue("Unwrapped, empty List should not be equal to empty 
IntList.",!ilist.equals(list));
  +        assertTrue("Unwrapped, empty IntList should not be equal to empty 
List.",!list.equals(ilist));
           
           assertEquals(new ListIntList(list),ilist);
           assertEquals(ilist,new ListIntList(list));
  
  
  
  1.1                  
jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/adapters/TestAll.java
  
  Index: TestAll.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/adapters/TestAll.java,v
 1.1 2003/02/26 19:17:24 rwaldhoff Exp $
   * ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments 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.primitives.adapters;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/02/26 19:17:24 $
   * @author Rodney Waldhoff
   */
  public class TestAll extends TestCase {
      public TestAll(String testName) {
          super(testName);
      }
  
      public static void main(String args[]) {
          String[] testCaseName = { TestAll.class.getName() };
          junit.textui.TestRunner.main(testCaseName);
      }
  
      public static Test suite() {
          TestSuite suite = new TestSuite();
          
          suite.addTest(TestIntListList.suite());
          suite.addTest(TestListIntList.suite());
          
          return suite;
      }
  }
  
  
  
  
  1.1                  
jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/adapters/TestIntListList.java
  
  Index: TestIntListList.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/adapters/TestIntListList.java,v
 1.1 2003/02/26 19:17:24 rwaldhoff Exp $
   * ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments 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.primitives.adapters;
  
  import java.util.List;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  
  import org.apache.commons.collections.BulkTest;
  import org.apache.commons.collections.TestList;
  import org.apache.commons.collections.primitives.ArrayIntList;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/02/26 19:17:24 $
   * @author Rodney Waldhoff
   */
  public class TestIntListList extends TestList {
  
      // conventional
      // ------------------------------------------------------------------------
  
      public TestIntListList(String testName) {
          super(testName);
      }
  
      public static Test suite() {
          TestSuite suite = BulkTest.makeSuite(TestIntListList.class);
          return suite;
      }
  
      // collections testing framework
      // ------------------------------------------------------------------------
  
      protected List makeEmptyList() {
          return new IntListList(new ArrayIntList());
      }
          
      protected Object[] getFullElements() {
          Integer[] elts = new Integer[10];
          for(int i=0;i<elts.length;i++) {
              elts[i] = new Integer(i);
          }
          return elts;
      }
  
      protected Object[] getOtherElements() {
          Integer[] elts = new Integer[10];
          for(int i=0;i<elts.length;i++) {
              elts[i] = new Integer(10 + i);
          }
          return elts;
      }
  
      // tests
      // ------------------------------------------------------------------------
  
      /** @todo need to add serialized form to cvs */
      public void testCanonicalEmptyCollectionExists() {
          // XXX FIX ME XXX
          // need to add a serialized form to cvs
      }
  
      /** @todo need to add serialized form to cvs */
      public void testCanonicalFullCollectionExists() {
          // XXX FIX ME XXX
          // need to add a serialized form to cvs
      }
  
      /** @todo need to add serialized form to cvs */
      public void testEmptyListCompatibility() {
          // XXX FIX ME XXX
          // need to add a serialized form to cvs
      }
  
      /** @todo need to add serialized form to cvs */
      public void testFullListCompatibility() {
          // XXX FIX ME XXX
          // need to add a serialized form to cvs
      }
  
  }
  
  
  
  1.1                  
jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/adapters/TestListIntList.java
  
  Index: TestListIntList.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/adapters/TestListIntList.java,v
 1.1 2003/02/26 19:17:24 rwaldhoff Exp $
   * ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments 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.primitives.adapters;
  
  import java.util.ArrayList;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  
  import org.apache.commons.collections.primitives.IntList;
  import org.apache.commons.collections.primitives.TestIntList;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/02/26 19:17:24 $
   * @author Rodney Waldhoff
   */
  public class TestListIntList extends TestIntList {
  
      // conventional
      // ------------------------------------------------------------------------
  
      public TestListIntList(String testName) {
          super(testName);
      }
  
      public static Test suite() {
          //TestSuite suite = BulkTest.makeSuite(TestListIntList.class);
          // java.util.SubList is not serializable
          TestSuite suite = new TestSuite(TestListIntList.class);
          return suite;
      }
  
      // collections testing framework
      // ------------------------------------------------------------------------
  
  
      /**
       * @see org.apache.commons.collections.primitives.TestIntList#makeEmptyIntList()
       */
      protected IntList makeEmptyIntList() {
          return new ListIntList(new ArrayList());
      }
      
      // tests
      // ------------------------------------------------------------------------
  
      /** @todo need to add serialized form to cvs */
      public void testCanonicalEmptyCollectionExists() {
          // XXX FIX ME XXX
          // need to add a serialized form to cvs
      }
  
      /** @todo need to add serialized form to cvs */
      public void testCanonicalFullCollectionExists() {
          // XXX FIX ME XXX
          // need to add a serialized form to cvs
      }
  
      /** @todo need to add serialized form to cvs */
      public void testEmptyListCompatibility() {
          // XXX FIX ME XXX
          // need to add a serialized form to cvs
      }
  
      /** @todo need to add serialized form to cvs */
      public void testFullListCompatibility() {
          // XXX FIX ME XXX
          // need to add a serialized form to cvs
      }
  
  
  }
  
  
  

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

Reply via email to