Convert protected methods to public to handle VerifyError
(due to inner classes being unable to see protected methods from another package) git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131349 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bf2681bc5b
commit
6bf2ec4c86
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/AbstractTestObject.java,v 1.1 2003/10/02 22:14:29 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/AbstractTestObject.java,v 1.2 2003/11/18 22:37:15 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -79,7 +79,7 @@ import java.io.Serializable;
|
|||
* you may still use this base set of cases. Simply override the
|
||||
* test case (method) your {@link Object} fails.
|
||||
*
|
||||
* @version $Revision: 1.1 $ $Date: 2003/10/02 22:14:29 $
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/18 22:37:15 $
|
||||
*
|
||||
* @author Rodney Waldhoff
|
||||
* @author Stephen Colebourne
|
||||
|
@ -105,7 +105,7 @@ public abstract class AbstractTestObject extends BulkTest {
|
|||
*
|
||||
* @return the object to test
|
||||
*/
|
||||
protected abstract Object makeObject();
|
||||
public abstract Object makeObject();
|
||||
|
||||
/**
|
||||
* Override this method if a subclass is testing an object
|
||||
|
@ -114,7 +114,7 @@ public abstract class AbstractTestObject extends BulkTest {
|
|||
*
|
||||
* @return true
|
||||
*/
|
||||
protected boolean supportsEmptyCollections() {
|
||||
public boolean supportsEmptyCollections() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ public abstract class AbstractTestObject extends BulkTest {
|
|||
*
|
||||
* @return true
|
||||
*/
|
||||
protected boolean supportsFullCollections() {
|
||||
public boolean supportsFullCollections() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ public abstract class AbstractTestObject extends BulkTest {
|
|||
* @return The version, or <code>null</code> if this object shouldn't be
|
||||
* tested for compatibility with previous versions.
|
||||
*/
|
||||
protected String getCompatibilityVersion() {
|
||||
public String getCompatibilityVersion() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/BulkTest.java,v 1.7 2003/11/18 21:28:16 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/BulkTest.java,v 1.8 2003/11/18 22:37:16 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -175,7 +175,7 @@ import junit.framework.TestSuite;
|
|||
* interpret bulk test methods.
|
||||
*
|
||||
* @author Paul Jack
|
||||
* @version $Id: BulkTest.java,v 1.7 2003/11/18 21:28:16 scolebourne Exp $
|
||||
* @version $Id: BulkTest.java,v 1.8 2003/11/18 22:37:16 scolebourne Exp $
|
||||
*/
|
||||
public class BulkTest extends TestCase implements Cloneable {
|
||||
|
||||
|
@ -257,7 +257,7 @@ public class BulkTest extends TestCase implements Cloneable {
|
|||
* @return an array of the names of tests to ignore, or null if
|
||||
* no tests should be ignored
|
||||
*/
|
||||
protected String[] ignoredTests() {
|
||||
public String[] ignoredTests() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestBeanMap.java,v 1.15 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestBeanMap.java,v 1.16 2003/11/18 22:37:15 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -69,7 +69,7 @@ import org.apache.commons.collections.map.AbstractTestMap;
|
|||
/**
|
||||
* Test cases for BeanMap
|
||||
*
|
||||
* @version $Revision: 1.15 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.16 $ $Date: 2003/11/18 22:37:15 $
|
||||
*
|
||||
* @author Morgan Delagrange
|
||||
* @author Stephen Colebourne
|
||||
|
@ -200,7 +200,7 @@ public class TestBeanMap extends AbstractTestMap {
|
|||
//
|
||||
// Then, I manually added the "class" key, which is a property that exists for
|
||||
// all beans (and all objects for that matter.
|
||||
protected Object[] getSampleKeys() {
|
||||
public Object[] getSampleKeys() {
|
||||
Object[] keys = new Object[] {
|
||||
"someIntValue",
|
||||
"someLongValue",
|
||||
|
@ -226,7 +226,7 @@ public class TestBeanMap extends AbstractTestMap {
|
|||
private Object objectInFullMap = new Object();
|
||||
|
||||
// note to self: the sample values were created manually
|
||||
protected Object[] getSampleValues() {
|
||||
public Object[] getSampleValues() {
|
||||
Object[] values = new Object[] {
|
||||
new Integer(1234),
|
||||
new Long(1298341928234L),
|
||||
|
@ -243,7 +243,7 @@ public class TestBeanMap extends AbstractTestMap {
|
|||
return values;
|
||||
}
|
||||
|
||||
protected Object[] getNewSampleValues() {
|
||||
public Object[] getNewSampleValues() {
|
||||
Object[] values = new Object[] {
|
||||
new Integer(223),
|
||||
new Long(23341928234L),
|
||||
|
@ -263,7 +263,7 @@ public class TestBeanMap extends AbstractTestMap {
|
|||
/**
|
||||
* Values is a dead copy in BeanMap, so refresh each time.
|
||||
*/
|
||||
protected void verifyValues() {
|
||||
public void verifyValues() {
|
||||
values = map.values();
|
||||
super.verifyValues();
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ public class TestBeanMap extends AbstractTestMap {
|
|||
* bean has. Adding and removing mappings is not possible, thus this
|
||||
* method is overridden to return false.
|
||||
*/
|
||||
protected boolean isPutAddSupported() {
|
||||
public boolean isPutAddSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -282,11 +282,11 @@ public class TestBeanMap extends AbstractTestMap {
|
|||
* bean has. Adding and removing mappings is not possible, thus this
|
||||
* method is overridden to return false.
|
||||
*/
|
||||
protected boolean isRemoveSupported() {
|
||||
public boolean isRemoveSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected Map makeFullMap() {
|
||||
public Map makeFullMap() {
|
||||
// note: These values must match (i.e. .equals() must return true)
|
||||
// those returned from getSampleValues().
|
||||
BeanWithProperties bean = new BeanWithProperties();
|
||||
|
@ -303,11 +303,11 @@ public class TestBeanMap extends AbstractTestMap {
|
|||
return new BeanMap(bean);
|
||||
}
|
||||
|
||||
protected Map makeEmptyMap() {
|
||||
public Map makeEmptyMap() {
|
||||
return new BeanMap();
|
||||
}
|
||||
|
||||
protected String[] ignoredTests() {
|
||||
public String[] ignoredTests() {
|
||||
// Ignore the serialization tests on collection views.
|
||||
return new String[] {
|
||||
"TestBeanMap.bulkTestMapEntrySet.testCanonicalEmptyCollectionExists",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestBinaryHeap.java,v 1.12 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestBinaryHeap.java,v 1.13 2003/11/18 22:37:16 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -73,7 +73,7 @@ import org.apache.commons.collections.comparators.ReverseComparator;
|
|||
/**
|
||||
* Tests the BinaryHeap.
|
||||
*
|
||||
* @version $Revision: 1.12 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.13 $ $Date: 2003/11/18 22:37:16 $
|
||||
*
|
||||
* @author Michael A. Smith
|
||||
*/
|
||||
|
@ -88,7 +88,7 @@ public class TestBinaryHeap extends AbstractTestCollection {
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
protected void verify() {
|
||||
public void verify() {
|
||||
super.verify();
|
||||
BinaryHeap heap = (BinaryHeap) collection;
|
||||
|
||||
|
@ -115,16 +115,16 @@ public class TestBinaryHeap extends AbstractTestCollection {
|
|||
* Overridden because UnboundedFifoBuffer isn't fail fast.
|
||||
* @return false
|
||||
*/
|
||||
protected boolean isFailFastSupported() {
|
||||
public boolean isFailFastSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
protected Collection makeConfirmedCollection() {
|
||||
public Collection makeConfirmedCollection() {
|
||||
return new ArrayList();
|
||||
}
|
||||
|
||||
protected Collection makeConfirmedFullCollection() {
|
||||
public Collection makeConfirmedFullCollection() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.addAll(Arrays.asList(getFullElements()));
|
||||
return list;
|
||||
|
@ -133,16 +133,16 @@ public class TestBinaryHeap extends AbstractTestCollection {
|
|||
/**
|
||||
* Return a new, empty {@link Object} to used for testing.
|
||||
*/
|
||||
protected Collection makeCollection() {
|
||||
public Collection makeCollection() {
|
||||
return new BinaryHeap();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
protected Object[] getFullElements() {
|
||||
public Object[] getFullElements() {
|
||||
return getFullNonNullStringElements();
|
||||
}
|
||||
|
||||
protected Object[] getOtherElements() {
|
||||
public Object[] getOtherElements() {
|
||||
return getOtherNonNullStringElements();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestBoundedFifoBuffer.java,v 1.10 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestBoundedFifoBuffer.java,v 1.11 2003/11/18 22:37:15 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -68,7 +68,7 @@ import org.apache.commons.collections.collection.AbstractTestCollection;
|
|||
/**
|
||||
* Test cases for BoundedFifoBuffer.
|
||||
*
|
||||
* @version $Revision: 1.10 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.11 $ $Date: 2003/11/18 22:37:15 $
|
||||
*
|
||||
* @author Paul Jack
|
||||
*/
|
||||
|
@ -88,7 +88,7 @@ public class TestBoundedFifoBuffer extends AbstractTestCollection {
|
|||
* the buffer contains the same elements in the same sequence as the
|
||||
* list.
|
||||
*/
|
||||
protected void verify() {
|
||||
public void verify() {
|
||||
super.verify();
|
||||
Iterator iterator1 = collection.iterator();
|
||||
Iterator iterator2 = confirmed.iterator();
|
||||
|
@ -105,7 +105,7 @@ public class TestBoundedFifoBuffer extends AbstractTestCollection {
|
|||
* Overridden because UnboundedFifoBuffer doesn't allow null elements.
|
||||
* @return false
|
||||
*/
|
||||
protected boolean isNullSupported() {
|
||||
public boolean isNullSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ public class TestBoundedFifoBuffer extends AbstractTestCollection {
|
|||
* Overridden because UnboundedFifoBuffer isn't fail fast.
|
||||
* @return false
|
||||
*/
|
||||
protected boolean isFailFastSupported() {
|
||||
public boolean isFailFastSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ public class TestBoundedFifoBuffer extends AbstractTestCollection {
|
|||
*
|
||||
* @return an empty ArrayList
|
||||
*/
|
||||
protected Collection makeConfirmedCollection() {
|
||||
public Collection makeConfirmedCollection() {
|
||||
return new ArrayList();
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ public class TestBoundedFifoBuffer extends AbstractTestCollection {
|
|||
*
|
||||
* @return a full ArrayList
|
||||
*/
|
||||
protected Collection makeConfirmedFullCollection() {
|
||||
public Collection makeConfirmedFullCollection() {
|
||||
Collection c = makeConfirmedCollection();
|
||||
c.addAll(java.util.Arrays.asList(getFullElements()));
|
||||
return c;
|
||||
|
@ -143,7 +143,7 @@ public class TestBoundedFifoBuffer extends AbstractTestCollection {
|
|||
*
|
||||
* @return an empty BoundedFifoBuffer
|
||||
*/
|
||||
protected Collection makeCollection() {
|
||||
public Collection makeCollection() {
|
||||
return new BoundedFifoBuffer(100);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestCircularFifoBuffer.java,v 1.6 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestCircularFifoBuffer.java,v 1.7 2003/11/18 22:37:16 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -69,7 +69,7 @@ import org.apache.commons.collections.collection.AbstractTestCollection;
|
|||
/**
|
||||
* Test cases for CircularFifoBuffer.
|
||||
*
|
||||
* @version $Revision: 1.6 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.7 $ $Date: 2003/11/18 22:37:16 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -89,7 +89,7 @@ public class TestCircularFifoBuffer extends AbstractTestCollection {
|
|||
* the buffer contains the same elements in the same sequence as the
|
||||
* list.
|
||||
*/
|
||||
protected void verify() {
|
||||
public void verify() {
|
||||
super.verify();
|
||||
Iterator iterator1 = collection.iterator();
|
||||
Iterator iterator2 = confirmed.iterator();
|
||||
|
@ -106,7 +106,7 @@ public class TestCircularFifoBuffer extends AbstractTestCollection {
|
|||
* Overridden because UnboundedFifoBuffer doesn't allow null elements.
|
||||
* @return false
|
||||
*/
|
||||
protected boolean isNullSupported() {
|
||||
public boolean isNullSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ public class TestCircularFifoBuffer extends AbstractTestCollection {
|
|||
* Overridden because UnboundedFifoBuffer isn't fail fast.
|
||||
* @return false
|
||||
*/
|
||||
protected boolean isFailFastSupported() {
|
||||
public boolean isFailFastSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ public class TestCircularFifoBuffer extends AbstractTestCollection {
|
|||
*
|
||||
* @return an empty ArrayList
|
||||
*/
|
||||
protected Collection makeConfirmedCollection() {
|
||||
public Collection makeConfirmedCollection() {
|
||||
return new ArrayList();
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ public class TestCircularFifoBuffer extends AbstractTestCollection {
|
|||
*
|
||||
* @return a full ArrayList
|
||||
*/
|
||||
protected Collection makeConfirmedFullCollection() {
|
||||
public Collection makeConfirmedFullCollection() {
|
||||
Collection c = makeConfirmedCollection();
|
||||
c.addAll(java.util.Arrays.asList(getFullElements()));
|
||||
return c;
|
||||
|
@ -144,7 +144,7 @@ public class TestCircularFifoBuffer extends AbstractTestCollection {
|
|||
*
|
||||
* @return an empty BoundedFifoBuffer
|
||||
*/
|
||||
protected Collection makeCollection() {
|
||||
public Collection makeCollection() {
|
||||
return new CircularFifoBuffer(100);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestCursorableLinkedList.java,v 1.15 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestCursorableLinkedList.java,v 1.16 2003/11/18 22:37:15 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -70,7 +70,7 @@ import org.apache.commons.collections.list.AbstractTestList;
|
|||
/**
|
||||
* Test class.
|
||||
*
|
||||
* @version $Revision: 1.15 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.16 $ $Date: 2003/11/18 22:37:15 $
|
||||
*
|
||||
* @author Rodney Waldhoff
|
||||
* @author Simon Kitching
|
||||
|
@ -1058,7 +1058,7 @@ public class TestCursorableLinkedList extends AbstractTestList {
|
|||
*
|
||||
* @return an array of sublist serialization test names
|
||||
*/
|
||||
protected String[] ignoredTests() {
|
||||
public String[] ignoredTests() {
|
||||
ArrayList list = new ArrayList();
|
||||
String prefix = "TestCursorableLinkedList";
|
||||
String bulk = ".bulkTestSubList";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestDoubleOrderedMap.java,v 1.12 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestDoubleOrderedMap.java,v 1.13 2003/11/18 22:37:15 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -79,7 +79,7 @@ import org.apache.commons.collections.map.AbstractTestMap;
|
|||
* Map that does not support duplicate keys, duplicate
|
||||
* values, or null values.
|
||||
*
|
||||
* @version $Revision: 1.12 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.13 $ $Date: 2003/11/18 22:37:15 $
|
||||
*
|
||||
* @author Marc Johnson
|
||||
* @author Stephen Colebourne
|
||||
|
@ -107,7 +107,7 @@ public class TestDoubleOrderedMap extends AbstractTestMap {
|
|||
/**
|
||||
* The default comparator in double ordered map does not allow null keys.
|
||||
**/
|
||||
protected boolean isAllowNullKey() {
|
||||
public boolean isAllowNullKey() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -115,14 +115,14 @@ public class TestDoubleOrderedMap extends AbstractTestMap {
|
|||
* The default comparator in double ordered map does not allow null keys,
|
||||
* and values are keys in this map.
|
||||
**/
|
||||
protected boolean isAllowNullValue() {
|
||||
public boolean isAllowNullValue() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Double ordered map does not support duplicate values
|
||||
**/
|
||||
protected boolean isAllowDuplicateValues() {
|
||||
public boolean isAllowDuplicateValues() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -134,18 +134,18 @@ public class TestDoubleOrderedMap extends AbstractTestMap {
|
|||
* differs from the standard Map contract which would replace the value
|
||||
* for that key and return it.
|
||||
*/
|
||||
protected boolean isPutChangeSupported() {
|
||||
public boolean isPutChangeSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* setValue() is not supported as it can change the map.
|
||||
*/
|
||||
protected boolean isSetValueSupported() {
|
||||
public boolean isSetValueSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected Map makeEmptyMap() {
|
||||
public Map makeEmptyMap() {
|
||||
return new DoubleOrderedMap();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestFlat3Map.java,v 1.3 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestFlat3Map.java,v 1.4 2003/11/18 22:37:16 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -69,7 +69,7 @@ import org.apache.commons.collections.map.AbstractTestMap;
|
|||
/**
|
||||
* JUnit tests.
|
||||
*
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.4 $ $Date: 2003/11/18 22:37:16 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -87,7 +87,7 @@ public class TestFlat3Map extends AbstractTestMap {
|
|||
return BulkTest.makeSuite(TestFlat3Map.class);
|
||||
}
|
||||
|
||||
protected Map makeEmptyMap() {
|
||||
public Map makeEmptyMap() {
|
||||
return new Flat3Map();
|
||||
}
|
||||
|
||||
|
@ -101,39 +101,39 @@ public class TestFlat3Map extends AbstractTestMap {
|
|||
super("TestFlatMapIterator");
|
||||
}
|
||||
|
||||
protected Object[] addSetValues() {
|
||||
public Object[] addSetValues() {
|
||||
return TestFlat3Map.this.getNewSampleValues();
|
||||
}
|
||||
|
||||
protected boolean supportsRemove() {
|
||||
public boolean supportsRemove() {
|
||||
return TestFlat3Map.this.isRemoveSupported();
|
||||
}
|
||||
|
||||
protected boolean supportsSetValue() {
|
||||
public boolean supportsSetValue() {
|
||||
return TestFlat3Map.this.isSetValueSupported();
|
||||
}
|
||||
|
||||
protected MapIterator makeEmptyMapIterator() {
|
||||
public MapIterator makeEmptyMapIterator() {
|
||||
resetEmpty();
|
||||
return ((Flat3Map) TestFlat3Map.this.map).mapIterator();
|
||||
}
|
||||
|
||||
protected MapIterator makeFullMapIterator() {
|
||||
public MapIterator makeFullMapIterator() {
|
||||
resetFull();
|
||||
return ((Flat3Map) TestFlat3Map.this.map).mapIterator();
|
||||
}
|
||||
|
||||
protected Map getMap() {
|
||||
public Map getMap() {
|
||||
// assumes makeFullMapIterator() called first
|
||||
return TestFlat3Map.this.map;
|
||||
}
|
||||
|
||||
protected Map getConfirmedMap() {
|
||||
public Map getConfirmedMap() {
|
||||
// assumes makeFullMapIterator() called first
|
||||
return TestFlat3Map.this.confirmed;
|
||||
}
|
||||
|
||||
protected void verify() {
|
||||
public void verify() {
|
||||
super.verify();
|
||||
TestFlat3Map.this.verify();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestHashBag.java,v 1.7 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestHashBag.java,v 1.8 2003/11/18 22:37:16 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -66,7 +66,7 @@ import org.apache.commons.collections.bag.AbstractTestBag;
|
|||
* Extension of {@link TestBag} for exercising the {@link HashBag}
|
||||
* implementation.
|
||||
*
|
||||
* @version $Revision: 1.7 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.8 $ $Date: 2003/11/18 22:37:16 $
|
||||
*
|
||||
* @author Chuck Burdick
|
||||
*/
|
||||
|
@ -85,7 +85,7 @@ public class TestHashBag extends AbstractTestBag {
|
|||
junit.textui.TestRunner.main(testCaseName);
|
||||
}
|
||||
|
||||
protected Bag makeBag() {
|
||||
public Bag makeBag() {
|
||||
return new HashBag();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestLRUMap.java,v 1.26 2003/11/01 18:47:18 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestLRUMap.java,v 1.27 2003/11/18 22:37:15 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -68,7 +68,7 @@ import junit.framework.Test;
|
|||
/**
|
||||
* Tests LRUMap.
|
||||
*
|
||||
* @version $Revision: 1.26 $ $Date: 2003/11/01 18:47:18 $
|
||||
* @version $Revision: 1.27 $ $Date: 2003/11/18 22:37:15 $
|
||||
*
|
||||
* @author James Strachan
|
||||
* @author Morgan Delagrange
|
||||
|
@ -98,7 +98,7 @@ public class TestLRUMap extends TestSequencedHashMap {
|
|||
/**
|
||||
* Override as test uses iterator() and getKey() in combination which doesn't work.
|
||||
*/
|
||||
protected String[] ignoredTests() {
|
||||
public String[] ignoredTests() {
|
||||
return new String[] {"TestLRUMap.bulkTestMapEntrySet.testMapEntrySetIteratorEntry"};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestLinkedList.java,v 1.6 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestLinkedList.java,v 1.7 2003/11/18 22:37:15 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -75,7 +75,7 @@ import org.apache.commons.collections.list.AbstractTestList;
|
|||
* you may still use this base set of cases. Simply override the
|
||||
* test case (method) your {@link List} fails.
|
||||
*
|
||||
* @version $Revision: 1.6 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.7 $ $Date: 2003/11/18 22:37:15 $
|
||||
*
|
||||
* @author Rich Dougherty
|
||||
*/
|
||||
|
@ -85,11 +85,11 @@ public abstract class TestLinkedList extends AbstractTestList {
|
|||
super(testName);
|
||||
}
|
||||
|
||||
protected List makeEmptyList() {
|
||||
public List makeEmptyList() {
|
||||
return makeEmptyLinkedList();
|
||||
}
|
||||
|
||||
protected List makeFullList() {
|
||||
public List makeFullList() {
|
||||
return makeFullLinkedList();
|
||||
}
|
||||
|
||||
|
@ -261,14 +261,14 @@ public abstract class TestLinkedList extends AbstractTestList {
|
|||
/**
|
||||
* Returns an empty {@link ArrayList}.
|
||||
*/
|
||||
protected Collection makeConfirmedCollection() {
|
||||
public Collection makeConfirmedCollection() {
|
||||
return new LinkedList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a full {@link ArrayList}.
|
||||
*/
|
||||
protected Collection makeConfirmedFullCollection() {
|
||||
public Collection makeConfirmedFullCollection() {
|
||||
List list = new LinkedList();
|
||||
list.addAll(Arrays.asList(getFullElements()));
|
||||
return list;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestMultiHashMap.java,v 1.14 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestMultiHashMap.java,v 1.15 2003/11/18 22:37:16 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -69,7 +69,7 @@ import org.apache.commons.collections.map.AbstractTestMap;
|
|||
/**
|
||||
* Unit Tests for <code>MultiHashMap</code>.
|
||||
*
|
||||
* @version $Revision: 1.14 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.15 $ $Date: 2003/11/18 22:37:16 $
|
||||
*
|
||||
* @author Unknown
|
||||
*/
|
||||
|
@ -93,7 +93,7 @@ public class TestMultiHashMap extends AbstractTestMap {
|
|||
return "2";
|
||||
}
|
||||
|
||||
protected Map makeEmptyMap() {
|
||||
public Map makeEmptyMap() {
|
||||
return new MultiHashMap();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestReferenceMap.java,v 1.14 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestReferenceMap.java,v 1.15 2003/11/18 22:37:15 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -67,7 +67,7 @@ import org.apache.commons.collections.map.AbstractTestMap;
|
|||
/**
|
||||
* Tests for ReferenceMap.
|
||||
*
|
||||
* @version $Revision: 1.14 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.15 $ $Date: 2003/11/18 22:37:15 $
|
||||
*
|
||||
* @author Paul Jack
|
||||
*/
|
||||
|
@ -86,7 +86,7 @@ public class TestReferenceMap extends AbstractTestMap {
|
|||
junit.textui.TestRunner.main(testCaseName);
|
||||
}
|
||||
|
||||
protected Map makeEmptyMap() {
|
||||
public Map makeEmptyMap() {
|
||||
ReferenceMap map = new ReferenceMap(ReferenceMap.WEAK, ReferenceMap.WEAK);
|
||||
return map;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestSequencedHashMap.java,v 1.23 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestSequencedHashMap.java,v 1.24 2003/11/18 22:37:15 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -73,7 +73,7 @@ import org.apache.commons.collections.map.AbstractTestMap;
|
|||
* Be sure to use the "labRat" instance whenever possible,
|
||||
* so that subclasses will be tested correctly.
|
||||
*
|
||||
* @version $Revision: 1.23 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.24 $ $Date: 2003/11/18 22:37:15 $
|
||||
*
|
||||
* @author Morgan Delagrange
|
||||
* @author Daniel Rall
|
||||
|
@ -112,7 +112,7 @@ public class TestSequencedHashMap extends AbstractTestMap {
|
|||
labRat = (SequencedHashMap) makeEmptyMap();
|
||||
}
|
||||
|
||||
protected Map makeEmptyMap() {
|
||||
public Map makeEmptyMap() {
|
||||
return new SequencedHashMap();
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ public class TestSequencedHashMap extends AbstractTestMap {
|
|||
assertEquals("test with non-existing key failed", -1, labRat.indexOf("NonExistingKey"));
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
public void tearDown() throws Exception {
|
||||
labRat = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestStaticBucketMap.java,v 1.8 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestStaticBucketMap.java,v 1.9 2003/11/18 22:37:16 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -67,7 +67,7 @@ import org.apache.commons.collections.map.AbstractTestMap;
|
|||
* Unit tests
|
||||
* {@link org.apache.commons.collections.StaticBucketMap}.
|
||||
*
|
||||
* @version $Revision: 1.8 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.9 $ $Date: 2003/11/18 22:37:16 $
|
||||
*
|
||||
* @author Michael A. Smith
|
||||
*/
|
||||
|
@ -86,11 +86,11 @@ public class TestStaticBucketMap extends AbstractTestMap {
|
|||
junit.textui.TestRunner.main(testCaseName);
|
||||
}
|
||||
|
||||
protected Map makeEmptyMap() {
|
||||
public Map makeEmptyMap() {
|
||||
return new StaticBucketMap(30);
|
||||
}
|
||||
|
||||
protected String[] ignoredTests() {
|
||||
public String[] ignoredTests() {
|
||||
String pre = "TestStaticBucketMap.bulkTestMap";
|
||||
String post = ".testCollectionIteratorFailFast";
|
||||
return new String[] {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestTreeBag.java,v 1.7 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestTreeBag.java,v 1.8 2003/11/18 22:37:16 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -66,7 +66,7 @@ import org.apache.commons.collections.bag.AbstractTestBag;
|
|||
* Extension of {@link TestBag} for exercising the {@link TreeBag}
|
||||
* implementation.
|
||||
*
|
||||
* @version $Revision: 1.7 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.8 $ $Date: 2003/11/18 22:37:16 $
|
||||
*
|
||||
* @author Chuck Burdick
|
||||
*/
|
||||
|
@ -85,7 +85,7 @@ public class TestTreeBag extends AbstractTestBag {
|
|||
junit.textui.TestRunner.main(testCaseName);
|
||||
}
|
||||
|
||||
protected Bag makeBag() {
|
||||
public Bag makeBag() {
|
||||
return new TreeBag();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestUnboundedFifoBuffer.java,v 1.9 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestUnboundedFifoBuffer.java,v 1.10 2003/11/18 22:37:16 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -68,7 +68,7 @@ import org.apache.commons.collections.collection.AbstractTestCollection;
|
|||
/**
|
||||
* Test cases for UnboundedFifoBuffer.
|
||||
*
|
||||
* @version $Revision: 1.9 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.10 $ $Date: 2003/11/18 22:37:16 $
|
||||
*
|
||||
* @author Unknown
|
||||
*/
|
||||
|
@ -87,7 +87,7 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
|
|||
* Verifies that the ArrayList has the same elements in the same
|
||||
* sequence as the UnboundedFifoBuffer.
|
||||
*/
|
||||
protected void verify() {
|
||||
public void verify() {
|
||||
super.verify();
|
||||
Iterator iterator1 = collection.iterator();
|
||||
Iterator iterator2 = confirmed.iterator();
|
||||
|
@ -104,7 +104,7 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
|
|||
* Overridden because UnboundedFifoBuffer doesn't allow null elements.
|
||||
* @return false
|
||||
*/
|
||||
protected boolean isNullSupported() {
|
||||
public boolean isNullSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
|
|||
* Overridden because UnboundedFifoBuffer isn't fail fast.
|
||||
* @return false
|
||||
*/
|
||||
protected boolean isFailFastSupported() {
|
||||
public boolean isFailFastSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
|
|||
*
|
||||
* @return an empty ArrayList
|
||||
*/
|
||||
protected Collection makeConfirmedCollection() {
|
||||
public Collection makeConfirmedCollection() {
|
||||
return new ArrayList();
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
|
|||
*
|
||||
* @return a full ArrayList
|
||||
*/
|
||||
protected Collection makeConfirmedFullCollection() {
|
||||
public Collection makeConfirmedFullCollection() {
|
||||
Collection c = makeConfirmedCollection();
|
||||
c.addAll(java.util.Arrays.asList(getFullElements()));
|
||||
return c;
|
||||
|
@ -142,7 +142,7 @@ public class TestUnboundedFifoBuffer extends AbstractTestCollection {
|
|||
*
|
||||
* @return an empty UnboundedFifoBuffer
|
||||
*/
|
||||
protected Collection makeCollection() {
|
||||
public Collection makeCollection() {
|
||||
return new UnboundedFifoBuffer(5);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bag/AbstractTestBag.java,v 1.1 2003/11/16 22:15:10 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bag/AbstractTestBag.java,v 1.2 2003/11/18 22:37:15 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -75,7 +75,7 @@ import org.apache.commons.collections.Bag;
|
|||
* you may still use this base set of cases. Simply override the
|
||||
* test case (method) your {@link Bag} fails.
|
||||
*
|
||||
* @version $Revision: 1.1 $ $Date: 2003/11/16 22:15:10 $
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/18 22:37:15 $
|
||||
*
|
||||
* @author Chuck Burdick
|
||||
* @author Stephen Colebourne
|
||||
|
@ -101,14 +101,14 @@ public abstract class AbstractTestBag extends AbstractTestObject {
|
|||
*
|
||||
* @return the bag to be tested
|
||||
*/
|
||||
protected abstract Bag makeBag();
|
||||
public abstract Bag makeBag();
|
||||
|
||||
/**
|
||||
* Implements the superclass method to return the Bag.
|
||||
*
|
||||
* @return the bag to be tested
|
||||
*/
|
||||
protected Object makeObject() {
|
||||
public Object makeObject() {
|
||||
return makeBag();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bag/TestPredicatedBag.java,v 1.2 2003/11/16 22:15:10 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bag/TestPredicatedBag.java,v 1.3 2003/11/18 22:37:15 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -72,7 +72,7 @@ import org.apache.commons.collections.PredicateUtils;
|
|||
* implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:10 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:15 $
|
||||
*
|
||||
* @author Phil Steitz
|
||||
*/
|
||||
|
@ -107,7 +107,7 @@ public class TestPredicatedBag extends AbstractTestBag {
|
|||
return PredicatedBag.decorate(bag, predicate);
|
||||
}
|
||||
|
||||
protected Bag makeBag() {
|
||||
public Bag makeBag() {
|
||||
return decorateBag(new HashBag(), truePredicate);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bag/TestPredicatedSortedBag.java,v 1.2 2003/11/16 22:15:10 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bag/TestPredicatedSortedBag.java,v 1.3 2003/11/18 22:37:15 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -73,7 +73,7 @@ import org.apache.commons.collections.TreeBag;
|
|||
* implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:10 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:15 $
|
||||
*
|
||||
* @author Phil Steitz
|
||||
*/
|
||||
|
@ -111,7 +111,7 @@ public class TestPredicatedSortedBag extends AbstractTestSortedBag {
|
|||
return PredicatedSortedBag.decorate(bag, predicate);
|
||||
}
|
||||
|
||||
protected Bag makeBag() {
|
||||
public Bag makeBag() {
|
||||
return decorateBag(emptyBag, truePredicate);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bag/TestTransformedBag.java,v 1.2 2003/11/16 22:15:10 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bag/TestTransformedBag.java,v 1.3 2003/11/18 22:37:15 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -69,7 +69,7 @@ import org.apache.commons.collections.collection.TestTransformedCollection;
|
|||
* implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:10 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:15 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -88,7 +88,7 @@ public class TestTransformedBag extends AbstractTestBag {
|
|||
junit.textui.TestRunner.main(testCaseName);
|
||||
}
|
||||
|
||||
protected Bag makeBag() {
|
||||
public Bag makeBag() {
|
||||
return TransformedBag.decorate(new HashBag(), TestTransformedCollection.NOOP_TRANSFORMER);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bag/TestTransformedSortedBag.java,v 1.2 2003/11/16 22:15:10 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bag/TestTransformedSortedBag.java,v 1.3 2003/11/18 22:37:15 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -69,7 +69,7 @@ import org.apache.commons.collections.collection.TestTransformedCollection;
|
|||
* implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:10 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:15 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -88,7 +88,7 @@ public class TestTransformedSortedBag extends AbstractTestSortedBag {
|
|||
junit.textui.TestRunner.main(testCaseName);
|
||||
}
|
||||
|
||||
protected Bag makeBag() {
|
||||
public Bag makeBag() {
|
||||
return TransformedSortedBag.decorate(new TreeBag(), TestTransformedCollection.NOOP_TRANSFORMER);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bag/TestTypedBag.java,v 1.2 2003/11/16 22:15:10 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bag/TestTypedBag.java,v 1.3 2003/11/18 22:37:15 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -70,7 +70,7 @@ import org.apache.commons.collections.HashBag;
|
|||
* implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:10 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:15 $
|
||||
*
|
||||
* @author Phil Steitz
|
||||
*/
|
||||
|
@ -99,7 +99,7 @@ public class TestTypedBag extends AbstractTestBag {
|
|||
return TypedBag.decorate(bag, claz);
|
||||
}
|
||||
|
||||
protected Bag makeBag() {
|
||||
public Bag makeBag() {
|
||||
return decorateBag(new HashBag(), objectClass);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bag/TestTypedSortedBag.java,v 1.2 2003/11/16 22:15:10 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bag/TestTypedSortedBag.java,v 1.3 2003/11/18 22:37:15 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -71,7 +71,7 @@ import org.apache.commons.collections.TreeBag;
|
|||
* implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:10 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:15 $
|
||||
*
|
||||
* @author Phil Steitz
|
||||
*/
|
||||
|
@ -102,7 +102,7 @@ public class TestTypedSortedBag extends AbstractTestSortedBag {
|
|||
return TypedSortedBag.decorate(bag, claz);
|
||||
}
|
||||
|
||||
protected Bag makeBag() {
|
||||
public Bag makeBag() {
|
||||
return decorateBag(emptyBag, objectClass);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/AbstractTestBidiMap.java,v 1.2 2003/11/16 22:15:11 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/AbstractTestBidiMap.java,v 1.3 2003/11/18 22:37:16 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -71,7 +71,7 @@ import org.apache.commons.collections.map.AbstractTestMap;
|
|||
/**
|
||||
* Abstract test class for {@link BidiMap} methods and contracts.
|
||||
*
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:11 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:16 $
|
||||
*
|
||||
* @author Matthew Hawthorne
|
||||
* @author Stephen Colebourne
|
||||
|
@ -109,14 +109,14 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
|
|||
*
|
||||
* @return an empty <code>BidiMap</code> implementation.
|
||||
*/
|
||||
protected abstract BidiMap makeEmptyBidiMap();
|
||||
public abstract BidiMap makeEmptyBidiMap();
|
||||
|
||||
/**
|
||||
* Override to create a full <code>BidiMap</code> other than the default.
|
||||
*
|
||||
* @return a full <code>BidiMap</code> implementation.
|
||||
*/
|
||||
protected BidiMap makeFullBidiMap() {
|
||||
public BidiMap makeFullBidiMap() {
|
||||
final BidiMap map = makeEmptyBidiMap();
|
||||
for (int i = 0; i < entries.length; i++) {
|
||||
map.put(entries[i][0], entries[i][1]);
|
||||
|
@ -127,21 +127,21 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
|
|||
/**
|
||||
* Override to return the empty BidiMap.
|
||||
*/
|
||||
protected final Map makeEmptyMap() {
|
||||
public final Map makeEmptyMap() {
|
||||
return makeEmptyBidiMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to indicate to AbstractTestMap this is a BidiMap.
|
||||
*/
|
||||
protected boolean isAllowDuplicateValues() {
|
||||
public boolean isAllowDuplicateValues() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override as DualHashBidiMap didn't exist until version 3.
|
||||
*/
|
||||
protected String getCompatibilityVersion() {
|
||||
public String getCompatibilityVersion() {
|
||||
return "3";
|
||||
}
|
||||
|
||||
|
@ -183,12 +183,12 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
|
|||
* <p>
|
||||
* This implementation checks the inverse map as well.
|
||||
*/
|
||||
protected void verify() {
|
||||
public void verify() {
|
||||
verifyInverse();
|
||||
super.verify();
|
||||
}
|
||||
|
||||
protected void verifyInverse() {
|
||||
public void verifyInverse() {
|
||||
assertEquals(map.size(), ((BidiMap) map).inverseBidiMap().size());
|
||||
Map map1 = new HashMap(map);
|
||||
Map map2 = new HashMap(((BidiMap) map).inverseBidiMap());
|
||||
|
@ -441,38 +441,38 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
|
|||
super();
|
||||
this.main = main;
|
||||
}
|
||||
protected BidiMap makeEmptyBidiMap() {
|
||||
public BidiMap makeEmptyBidiMap() {
|
||||
return main.makeEmptyBidiMap().inverseBidiMap();
|
||||
}
|
||||
protected BidiMap makeFullBidiMap() {
|
||||
public BidiMap makeFullBidiMap() {
|
||||
return main.makeFullBidiMap().inverseBidiMap();
|
||||
}
|
||||
protected Object[] getSampleKeys() {
|
||||
public Object[] getSampleKeys() {
|
||||
return main.getSampleValues();
|
||||
}
|
||||
protected Object[] getSampleValues() {
|
||||
public Object[] getSampleValues() {
|
||||
return main.getSampleKeys();
|
||||
}
|
||||
|
||||
protected String getCompatibilityVersion() {
|
||||
public String getCompatibilityVersion() {
|
||||
return main.getCompatibilityVersion();
|
||||
}
|
||||
protected boolean isAllowNullKey() {
|
||||
public boolean isAllowNullKey() {
|
||||
return main.isAllowNullKey();
|
||||
}
|
||||
protected boolean isAllowNullValue() {
|
||||
public boolean isAllowNullValue() {
|
||||
return main.isAllowNullValue();
|
||||
}
|
||||
protected boolean isPutAddSupported() {
|
||||
public boolean isPutAddSupported() {
|
||||
return main.isPutAddSupported();
|
||||
}
|
||||
protected boolean isPutChangeSupported() {
|
||||
public boolean isPutChangeSupported() {
|
||||
return main.isPutChangeSupported();
|
||||
}
|
||||
protected boolean isSetValueSupported() {
|
||||
public boolean isSetValueSupported() {
|
||||
return main.isSetValueSupported();
|
||||
}
|
||||
protected boolean isRemoveSupported() {
|
||||
public boolean isRemoveSupported() {
|
||||
return main.isRemoveSupported();
|
||||
}
|
||||
|
||||
|
@ -488,39 +488,39 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
|
|||
super("TestBidiMapIterator");
|
||||
}
|
||||
|
||||
protected Object[] addSetValues() {
|
||||
public Object[] addSetValues() {
|
||||
return AbstractTestBidiMap.this.getNewSampleValues();
|
||||
}
|
||||
|
||||
protected boolean supportsRemove() {
|
||||
public boolean supportsRemove() {
|
||||
return AbstractTestBidiMap.this.isRemoveSupported();
|
||||
}
|
||||
|
||||
protected boolean supportsSetValue() {
|
||||
public boolean supportsSetValue() {
|
||||
return AbstractTestBidiMap.this.isSetValueSupported();
|
||||
}
|
||||
|
||||
protected MapIterator makeEmptyMapIterator() {
|
||||
public MapIterator makeEmptyMapIterator() {
|
||||
resetEmpty();
|
||||
return ((BidiMap) AbstractTestBidiMap.this.map).mapIterator();
|
||||
}
|
||||
|
||||
protected MapIterator makeFullMapIterator() {
|
||||
public MapIterator makeFullMapIterator() {
|
||||
resetFull();
|
||||
return ((BidiMap) AbstractTestBidiMap.this.map).mapIterator();
|
||||
}
|
||||
|
||||
protected Map getMap() {
|
||||
public Map getMap() {
|
||||
// assumes makeFullMapIterator() called first
|
||||
return AbstractTestBidiMap.this.map;
|
||||
}
|
||||
|
||||
protected Map getConfirmedMap() {
|
||||
public Map getConfirmedMap() {
|
||||
// assumes makeFullMapIterator() called first
|
||||
return AbstractTestBidiMap.this.confirmed;
|
||||
}
|
||||
|
||||
protected void verify() {
|
||||
public void verify() {
|
||||
super.verify();
|
||||
AbstractTestBidiMap.this.verify();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java,v 1.3 2003/11/16 22:15:11 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java,v 1.4 2003/11/18 22:37:16 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -75,7 +75,7 @@ import org.apache.commons.collections.map.AbstractTestSortedMap;
|
|||
/**
|
||||
* Abstract test class for {@link SortedBidiMap} methods and contracts.
|
||||
*
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/16 22:15:11 $
|
||||
* @version $Revision: 1.4 $ $Date: 2003/11/18 22:37:16 $
|
||||
*
|
||||
* @author Matthew Hawthorne
|
||||
* @author Stephen Colebourne
|
||||
|
@ -119,13 +119,13 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
protected boolean isAllowNullKey() {
|
||||
public boolean isAllowNullKey() {
|
||||
return false;
|
||||
}
|
||||
protected boolean isAllowNullValue() {
|
||||
public boolean isAllowNullValue() {
|
||||
return false;
|
||||
}
|
||||
protected Map makeConfirmedMap() {
|
||||
public Map makeConfirmedMap() {
|
||||
return new TreeMap();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/TestDualHashBidiMap.java,v 1.1 2003/11/16 20:35:46 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/TestDualHashBidiMap.java,v 1.2 2003/11/18 22:37:16 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -65,7 +65,7 @@ import org.apache.commons.collections.BulkTest;
|
|||
/**
|
||||
* JUnit tests.
|
||||
*
|
||||
* @version $Revision: 1.1 $ $Date: 2003/11/16 20:35:46 $
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/18 22:37:16 $
|
||||
*
|
||||
* @author Matthew Hawthorne
|
||||
* @author Stephen Colebourne
|
||||
|
@ -84,14 +84,14 @@ public class TestDualHashBidiMap extends AbstractTestBidiMap {
|
|||
super(testName);
|
||||
}
|
||||
|
||||
protected BidiMap makeEmptyBidiMap() {
|
||||
public BidiMap makeEmptyBidiMap() {
|
||||
return new DualHashBidiMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to prevent infinite recursion of tests.
|
||||
*/
|
||||
protected String[] ignoredTests() {
|
||||
public String[] ignoredTests() {
|
||||
return new String[] {"TestDualHashBidiMap.bulkTestInverseMap.bulkTestInverseMap"};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap.java,v 1.1 2003/11/16 20:35:46 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap.java,v 1.2 2003/11/18 22:37:16 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -65,7 +65,7 @@ import org.apache.commons.collections.BulkTest;
|
|||
/**
|
||||
* JUnit tests.
|
||||
*
|
||||
* @version $Revision: 1.1 $ $Date: 2003/11/16 20:35:46 $
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/18 22:37:16 $
|
||||
*
|
||||
* @author Matthew Hawthorne
|
||||
* @author Stephen Colebourne
|
||||
|
@ -84,14 +84,14 @@ public class TestDualTreeBidiMap extends AbstractTestSortedBidiMap {
|
|||
super(testName);
|
||||
}
|
||||
|
||||
protected BidiMap makeEmptyBidiMap() {
|
||||
public BidiMap makeEmptyBidiMap() {
|
||||
return new DualTreeBidiMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to prevent infinite recursion of tests.
|
||||
*/
|
||||
protected String[] ignoredTests() {
|
||||
public String[] ignoredTests() {
|
||||
return new String[] {"TestDualTreeBidiMap.bulkTestInverseMap.bulkTestInverseMap"};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/TestTreeBidiMap.java,v 1.1 2003/11/16 20:35:46 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/TestTreeBidiMap.java,v 1.2 2003/11/18 22:37:16 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -68,7 +68,7 @@ import org.apache.commons.collections.BulkTest;
|
|||
/**
|
||||
* JUnit tests.
|
||||
*
|
||||
* @version $Revision: 1.1 $ $Date: 2003/11/16 20:35:46 $
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/18 22:37:16 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -86,30 +86,30 @@ public class TestTreeBidiMap extends AbstractTestBidiMap {
|
|||
super(testName);
|
||||
}
|
||||
|
||||
protected BidiMap makeEmptyBidiMap() {
|
||||
public BidiMap makeEmptyBidiMap() {
|
||||
return new TreeBidiMap();
|
||||
}
|
||||
|
||||
protected Map makeConfirmedMap() {
|
||||
public Map makeConfirmedMap() {
|
||||
return new TreeMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to prevent infinite recursion of tests.
|
||||
*/
|
||||
protected String[] ignoredTests() {
|
||||
public String[] ignoredTests() {
|
||||
return new String[] {"TestTreeBidiMap.bulkTestInverseMap.bulkTestInverseMap"};
|
||||
}
|
||||
|
||||
protected boolean isAllowNullKey() {
|
||||
public boolean isAllowNullKey() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isAllowNullValue() {
|
||||
public boolean isAllowNullValue() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isSetValueSupported() {
|
||||
public boolean isSetValueSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/buffer/TestBlockingBuffer.java,v 1.1 2003/11/16 00:05:46 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/buffer/TestBlockingBuffer.java,v 1.2 2003/11/18 22:37:16 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -75,7 +75,7 @@ import org.apache.commons.collections.BufferUnderflowException;
|
|||
* implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.1 $
|
||||
* @version $Revision: 1.2 $
|
||||
*
|
||||
* @author Janek Bogucki
|
||||
* @author Phil Steitz
|
||||
|
@ -95,7 +95,7 @@ public class TestBlockingBuffer extends AbstractTestObject {
|
|||
junit.textui.TestRunner.main(testCaseName);
|
||||
}
|
||||
|
||||
protected Object makeObject() {
|
||||
public Object makeObject() {
|
||||
return BlockingBuffer.decorate(new MyBuffer());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java,v 1.1 2003/11/16 22:15:11 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java,v 1.2 2003/11/18 22:37:18 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -78,7 +78,7 @@ import org.apache.commons.collections.AbstractTestObject;
|
|||
* You should create a concrete subclass of this class to test any custom
|
||||
* {@link Collection} implementation. At minimum, you'll have to
|
||||
* implement the {@link #makeCollection()} method. You might want to
|
||||
* override some of the additional protected methods as well:
|
||||
* override some of the additional public methods as well:
|
||||
* <p>
|
||||
* <b>Element Population Methods</b>
|
||||
* <p>
|
||||
|
@ -149,7 +149,7 @@ import org.apache.commons.collections.AbstractTestObject;
|
|||
* you may still use this base set of cases. Simply override the
|
||||
* test case (method) your {@link Collection} fails.
|
||||
*
|
||||
* @version $Revision: 1.1 $ $Date: 2003/11/16 22:15:11 $
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/18 22:37:18 $
|
||||
*
|
||||
* @author Rodney Waldhoff
|
||||
* @author Paul Jack
|
||||
|
@ -176,7 +176,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
|
|||
/**
|
||||
* A collection instance that will be used for testing.
|
||||
*/
|
||||
protected Collection collection;
|
||||
public Collection collection;
|
||||
|
||||
/**
|
||||
* Confirmed collection. This is an instance of a collection that is
|
||||
|
@ -186,7 +186,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
|
|||
* collection, and then calling verify() to make sure your collection
|
||||
* still matches the confirmed collection.
|
||||
*/
|
||||
protected Collection confirmed;
|
||||
public Collection confirmed;
|
||||
|
||||
/**
|
||||
* JUnit constructor.
|
||||
|
@ -220,7 +220,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
|
|||
* should provide additional tests on iterator.remove() to make sure the
|
||||
* proper elements are removed when remove() is called on the iterator.
|
||||
**/
|
||||
protected boolean areEqualElementsDistinguishable() {
|
||||
public boolean areEqualElementsDistinguishable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
|
|||
* Default implementation returns true. Override if your collection
|
||||
* class does not support add or addAll.
|
||||
*/
|
||||
protected boolean isAddSupported() {
|
||||
public boolean isAddSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
|
|||
* Default implementation returns true. Override if your collection
|
||||
* class does not support removal operations.
|
||||
*/
|
||||
protected boolean isRemoveSupported() {
|
||||
public boolean isRemoveSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
|
|||
* Returns true to indicate that the collection supports holding null.
|
||||
* The default implementation returns true;
|
||||
*/
|
||||
protected boolean isNullSupported() {
|
||||
public boolean isNullSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
|
|||
* Returns true to indicate that the collection supports fail fast iterators.
|
||||
* The default implementation returns true;
|
||||
*/
|
||||
protected boolean isFailFastSupported() {
|
||||
public boolean isFailFastSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
|
|||
* Verifies that {@link #collection} and {@link #confirmed} have
|
||||
* identical state.
|
||||
*/
|
||||
protected void verify() {
|
||||
public void verify() {
|
||||
int confirmedSize = confirmed.size();
|
||||
assertEquals("Collection size should match confirmed collection's",
|
||||
confirmedSize, collection.size());
|
||||
|
@ -345,7 +345,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
|
|||
* collections. Invoke this method before performing a modification
|
||||
* test.
|
||||
*/
|
||||
protected void resetEmpty() {
|
||||
public void resetEmpty() {
|
||||
this.collection = makeCollection();
|
||||
this.confirmed = makeConfirmedCollection();
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
|
|||
* collections. Invoke this method before performing a modification
|
||||
* test.
|
||||
*/
|
||||
protected void resetFull() {
|
||||
public void resetFull() {
|
||||
this.collection = makeFullCollection();
|
||||
this.confirmed = makeConfirmedFullCollection();
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
|
|||
*
|
||||
* @return a confirmed empty collection
|
||||
*/
|
||||
protected abstract Collection makeConfirmedCollection();
|
||||
public abstract Collection makeConfirmedCollection();
|
||||
|
||||
/**
|
||||
* Returns a confirmed full collection.
|
||||
|
@ -378,12 +378,12 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
|
|||
*
|
||||
* @return a confirmed full collection
|
||||
*/
|
||||
protected abstract Collection makeConfirmedFullCollection();
|
||||
public abstract Collection makeConfirmedFullCollection();
|
||||
|
||||
/**
|
||||
* Return a new, empty {@link Collection} to be used for testing.
|
||||
*/
|
||||
protected abstract Collection makeCollection();
|
||||
public abstract Collection makeCollection();
|
||||
|
||||
/**
|
||||
* Returns a full collection to be used for testing. The collection
|
||||
|
@ -393,7 +393,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
|
|||
* the results of {@link #getFullElements()}. Override this default
|
||||
* if your collection doesn't support addAll.
|
||||
*/
|
||||
protected Collection makeFullCollection() {
|
||||
public Collection makeFullCollection() {
|
||||
Collection c = makeCollection();
|
||||
c.addAll(Arrays.asList(getFullElements()));
|
||||
return c;
|
||||
|
@ -402,14 +402,14 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
|
|||
/**
|
||||
* Returns an empty collection for Object tests.
|
||||
*/
|
||||
protected Object makeObject() {
|
||||
public Object makeObject() {
|
||||
return makeCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Map Entry that is independent of the first and the map.
|
||||
*/
|
||||
protected Map.Entry cloneMapEntry(Map.Entry entry) {
|
||||
public Map.Entry cloneMapEntry(Map.Entry entry) {
|
||||
HashMap map = new HashMap();
|
||||
map.put(entry.getKey(), entry.getValue());
|
||||
return (Map.Entry) map.entrySet().iterator().next();
|
||||
|
@ -426,7 +426,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
|
|||
* override {@link #makeFullCollection()}, you <I>must</I> override
|
||||
* this method to reflect the contents of a full collection.
|
||||
*/
|
||||
protected Object[] getFullElements() {
|
||||
public Object[] getFullElements() {
|
||||
if (isNullSupported()) {
|
||||
ArrayList list = new ArrayList();
|
||||
list.addAll(Arrays.asList(getFullNonNullElements()));
|
||||
|
@ -446,7 +446,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
|
|||
* to an empty or full collection, so if your collection restricts
|
||||
* certain kinds of elements, you should override this method.
|
||||
*/
|
||||
protected Object[] getOtherElements() {
|
||||
public Object[] getOtherElements() {
|
||||
return getOtherNonNullElements();
|
||||
}
|
||||
|
||||
|
@ -459,7 +459,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
|
|||
* the results of this method if your collection does not support
|
||||
* the null element.
|
||||
*/
|
||||
protected Object[] getFullNonNullElements() {
|
||||
public Object[] getFullNonNullElements() {
|
||||
return new Object[] {
|
||||
new String(""),
|
||||
new String("One"),
|
||||
|
@ -487,7 +487,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
|
|||
* {@link #getOtherElements()}. Includes many objects
|
||||
* of different types.
|
||||
*/
|
||||
protected Object[] getOtherNonNullElements() {
|
||||
public Object[] getOtherNonNullElements() {
|
||||
return new Object[] {
|
||||
new Integer(0),
|
||||
new Float(0),
|
||||
|
@ -507,7 +507,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
|
|||
* the results of this method if your collection does not support
|
||||
* heterogenous elements or the null element.
|
||||
*/
|
||||
protected Object[] getFullNonNullStringElements() {
|
||||
public Object[] getFullNonNullStringElements() {
|
||||
return new Object[] {
|
||||
"If","the","dull","substance","of","my","flesh","were","thought",
|
||||
"Injurious","distance","could","not","stop","my","way",
|
||||
|
@ -520,7 +520,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
|
|||
* the results of this method if your collection does not support
|
||||
* heterogenous elements or the null element.
|
||||
*/
|
||||
protected Object[] getOtherNonNullStringElements() {
|
||||
public Object[] getOtherNonNullStringElements() {
|
||||
return new Object[] {
|
||||
"For","then","despite",/* of */"space","I","would","be","brought",
|
||||
"From","limits","far","remote","where","thou","dost","stay"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/collection/TestCompositeCollection.java,v 1.2 2003/11/16 22:15:11 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/collection/TestCompositeCollection.java,v 1.3 2003/11/18 22:37:18 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
|
@ -68,7 +68,7 @@ import junit.framework.TestSuite;
|
|||
* {@link CompositeCollection} implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:11 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:18 $
|
||||
*
|
||||
* @author Brian McCallister
|
||||
* @author Phil Steitz
|
||||
|
@ -92,11 +92,11 @@ public class TestCompositeCollection extends AbstractTestCollection {
|
|||
/**
|
||||
* Run stock collection tests without Mutator, so turn off add, remove
|
||||
*/
|
||||
protected boolean isAddSupported() {
|
||||
public boolean isAddSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isRemoveSupported() {
|
||||
public boolean isRemoveSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -111,14 +111,14 @@ public class TestCompositeCollection extends AbstractTestCollection {
|
|||
return new HashSet();
|
||||
}
|
||||
|
||||
protected Object[] getFullElements() {
|
||||
public Object[] getFullElements() {
|
||||
return new Object[] {"1", "2", "3", "4"};
|
||||
}
|
||||
|
||||
/**
|
||||
* Full collection consists of 5 collections, each with one element
|
||||
*/
|
||||
protected Collection makeFullCollection() {
|
||||
public Collection makeFullCollection() {
|
||||
CompositeCollection compositeCollection = new CompositeCollection();
|
||||
Object[] elements = getFullElements();
|
||||
for (int i = 0; i < elements.length; i++) {
|
||||
|
@ -132,7 +132,7 @@ public class TestCompositeCollection extends AbstractTestCollection {
|
|||
/**
|
||||
* Full collection should look like a collection with 5 elements
|
||||
*/
|
||||
protected Collection makeConfirmedFullCollection() {
|
||||
public Collection makeConfirmedFullCollection() {
|
||||
Collection collection = new HashSet();
|
||||
collection.addAll(Arrays.asList(getFullElements()));
|
||||
return collection;
|
||||
|
|
|
@ -69,7 +69,7 @@ import org.apache.commons.collections.PredicateUtils;
|
|||
* {@link PredicatedCollection} implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:11 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:18 $
|
||||
*
|
||||
* @author Phil Steitz
|
||||
*/
|
||||
|
@ -105,17 +105,17 @@ public class TestPredicatedCollection extends AbstractTestCollection {
|
|||
return new ArrayList();
|
||||
}
|
||||
|
||||
protected Object[] getFullElements() {
|
||||
public Object[] getFullElements() {
|
||||
return new Object[] {"1", "3", "5", "7", "2", "4", "6"};
|
||||
}
|
||||
|
||||
protected Collection makeFullCollection() {
|
||||
public Collection makeFullCollection() {
|
||||
List list = new ArrayList();
|
||||
list.addAll(Arrays.asList(getFullElements()));
|
||||
return decorateCollection(list, truePredicate);
|
||||
}
|
||||
|
||||
protected Collection makeConfirmedFullCollection() {
|
||||
public Collection makeConfirmedFullCollection() {
|
||||
List list = new ArrayList();
|
||||
list.addAll(Arrays.asList(getFullElements()));
|
||||
return list;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/collection/TestTransformedCollection.java,v 1.2 2003/11/16 22:15:11 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/collection/TestTransformedCollection.java,v 1.3 2003/11/18 22:37:18 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -73,7 +73,7 @@ import org.apache.commons.collections.Transformer;
|
|||
* implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:11 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:18 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -112,7 +112,7 @@ public class TestTransformedCollection extends AbstractTestCollection {
|
|||
return new ArrayList();
|
||||
}
|
||||
|
||||
protected Collection makeConfirmedFullCollection() {
|
||||
public Collection makeConfirmedFullCollection() {
|
||||
List list = new ArrayList();
|
||||
list.addAll(Arrays.asList(getFullElements()));
|
||||
return list;
|
||||
|
@ -122,18 +122,18 @@ public class TestTransformedCollection extends AbstractTestCollection {
|
|||
return TransformedCollection.decorate(new ArrayList(), NOOP_TRANSFORMER);
|
||||
}
|
||||
|
||||
protected Collection makeFullCollection() {
|
||||
public Collection makeFullCollection() {
|
||||
List list = new ArrayList();
|
||||
list.addAll(Arrays.asList(getFullElements()));
|
||||
return TransformedCollection.decorate(list, NOOP_TRANSFORMER);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
protected Object[] getFullElements() {
|
||||
public Object[] getFullElements() {
|
||||
return new Object[] {"1", "3", "5", "7", "2", "4", "6"};
|
||||
}
|
||||
|
||||
protected Object[] getOtherElements() {
|
||||
public Object[] getOtherElements() {
|
||||
return new Object[] {"9", "88", "678", "87", "98", "78", "99"};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java,v 1.2 2003/10/02 22:14:35 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java,v 1.3 2003/11/18 22:37:18 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -92,14 +92,14 @@ public abstract class AbstractTestComparator extends AbstractTestObject {
|
|||
*
|
||||
* @return the comparator to test
|
||||
*/
|
||||
protected abstract Comparator makeComparator();
|
||||
public abstract Comparator makeComparator();
|
||||
|
||||
/**
|
||||
* Implement this method to return a list of sorted objects.
|
||||
*
|
||||
* @return sorted objects
|
||||
*/
|
||||
protected abstract List getComparableObjectsOrdered();
|
||||
public abstract List getComparableObjectsOrdered();
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -107,7 +107,7 @@ public abstract class AbstractTestComparator extends AbstractTestObject {
|
|||
*
|
||||
* @return a full iterator
|
||||
*/
|
||||
protected Object makeObject() {
|
||||
public Object makeObject() {
|
||||
return makeComparator();
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ public abstract class AbstractTestComparator extends AbstractTestObject {
|
|||
* Overrides superclass to set the compatability to version 2
|
||||
* as there were no Comparators in version 1.x.
|
||||
*/
|
||||
protected String getCompatibilityVersion() {
|
||||
public String getCompatibilityVersion() {
|
||||
return "2";
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/comparators/TestBooleanComparator.java,v 1.6 2003/10/06 21:02:50 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/comparators/TestBooleanComparator.java,v 1.7 2003/11/18 22:37:18 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -67,7 +67,7 @@ import junit.framework.TestSuite;
|
|||
/**
|
||||
* Tests for {@link BooleanComparator}.
|
||||
*
|
||||
* @version $Revision: 1.6 $ $Date: 2003/10/06 21:02:50 $
|
||||
* @version $Revision: 1.7 $ $Date: 2003/11/18 22:37:18 $
|
||||
*
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
|
@ -87,11 +87,11 @@ public class TestBooleanComparator extends AbstractTestComparator {
|
|||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
protected Comparator makeComparator() {
|
||||
public Comparator makeComparator() {
|
||||
return new BooleanComparator();
|
||||
}
|
||||
|
||||
protected List getComparableObjectsOrdered() {
|
||||
public List getComparableObjectsOrdered() {
|
||||
List list = new ArrayList();
|
||||
list.add(new Boolean(false));
|
||||
list.add(Boolean.FALSE);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/comparators/TestComparableComparator.java,v 1.3 2003/10/01 22:14:48 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/comparators/TestComparableComparator.java,v 1.4 2003/11/18 22:37:18 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -67,7 +67,7 @@ import junit.framework.TestSuite;
|
|||
/**
|
||||
* Tests for ComparableComparator.
|
||||
*
|
||||
* @version $Revision: 1.3 $ $Date: 2003/10/01 22:14:48 $
|
||||
* @version $Revision: 1.4 $ $Date: 2003/11/18 22:37:18 $
|
||||
*
|
||||
* @author Unknown
|
||||
*/
|
||||
|
@ -81,11 +81,11 @@ public class TestComparableComparator extends AbstractTestComparator {
|
|||
return new TestSuite(TestComparableComparator.class);
|
||||
}
|
||||
|
||||
protected Comparator makeComparator() {
|
||||
public Comparator makeComparator() {
|
||||
return new ComparableComparator();
|
||||
}
|
||||
|
||||
protected List getComparableObjectsOrdered() {
|
||||
public List getComparableObjectsOrdered() {
|
||||
List list = new LinkedList();
|
||||
list.add(new Integer(1));
|
||||
list.add(new Integer(2));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/comparators/TestComparatorChain.java,v 1.7 2003/10/01 22:14:48 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/comparators/TestComparatorChain.java,v 1.8 2003/11/18 22:37:18 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -68,7 +68,7 @@ import junit.framework.TestSuite;
|
|||
/**
|
||||
* Tests for ComparatorChain.
|
||||
*
|
||||
* @version $Revision: 1.7 $ $Date: 2003/10/01 22:14:48 $
|
||||
* @version $Revision: 1.8 $ $Date: 2003/11/18 22:37:18 $
|
||||
*
|
||||
* @author Unknown
|
||||
*/
|
||||
|
@ -82,7 +82,7 @@ public class TestComparatorChain extends AbstractTestComparator {
|
|||
return new TestSuite(TestComparatorChain.class);
|
||||
}
|
||||
|
||||
protected Comparator makeComparator() {
|
||||
public Comparator makeComparator() {
|
||||
ComparatorChain chain = new ComparatorChain(new ColumnComparator(0));
|
||||
chain.addComparator(new ColumnComparator(1),true); // reverse the second column
|
||||
chain.addComparator(new ColumnComparator(2),false);
|
||||
|
@ -159,7 +159,7 @@ public class TestComparatorChain extends AbstractTestComparator {
|
|||
assertTrue(chain.compare(new Integer(4), new Integer(4)) == 0);
|
||||
}
|
||||
|
||||
protected List getComparableObjectsOrdered() {
|
||||
public List getComparableObjectsOrdered() {
|
||||
List list = new LinkedList();
|
||||
// this is the correct order assuming a
|
||||
// "0th forward, 1st reverse, 2nd forward" sort
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/comparators/TestNullComparator.java,v 1.6 2003/10/01 22:14:48 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/comparators/TestNullComparator.java,v 1.7 2003/11/18 22:37:18 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -67,7 +67,7 @@ import junit.framework.TestSuite;
|
|||
/**
|
||||
* Test the NullComparator.
|
||||
*
|
||||
* @version $Revision: 1.6 $ $Date: 2003/10/01 22:14:48 $
|
||||
* @version $Revision: 1.7 $ $Date: 2003/11/18 22:37:18 $
|
||||
*
|
||||
* @author Michael A. Smith
|
||||
*/
|
||||
|
@ -93,11 +93,11 @@ public abstract class TestNullComparator extends AbstractTestComparator {
|
|||
super(testName);
|
||||
}
|
||||
|
||||
protected Comparator makeComparator() {
|
||||
public Comparator makeComparator() {
|
||||
return new NullComparator();
|
||||
}
|
||||
|
||||
protected List getComparableObjectsOrdered() {
|
||||
public List getComparableObjectsOrdered() {
|
||||
List list = new LinkedList();
|
||||
list.add(new Integer(1));
|
||||
list.add(new Integer(2));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/comparators/TestReverseComparator.java,v 1.6 2003/10/01 22:14:48 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/comparators/TestReverseComparator.java,v 1.7 2003/11/18 22:37:18 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -72,7 +72,7 @@ import junit.framework.TestSuite;
|
|||
/**
|
||||
* Tests for ReverseComparator.
|
||||
*
|
||||
* @version $Revision: 1.6 $ $Date: 2003/10/01 22:14:48 $
|
||||
* @version $Revision: 1.7 $ $Date: 2003/11/18 22:37:18 $
|
||||
*
|
||||
* @author Unknown
|
||||
*/
|
||||
|
@ -96,11 +96,11 @@ public class TestReverseComparator extends AbstractTestComparator {
|
|||
*
|
||||
* @return Comparator that returns "natural" order
|
||||
*/
|
||||
protected Comparator makeComparator() {
|
||||
public Comparator makeComparator() {
|
||||
return new ReverseComparator(Collections.reverseOrder());
|
||||
}
|
||||
|
||||
protected List getComparableObjectsOrdered() {
|
||||
public List getComparableObjectsOrdered() {
|
||||
List list = new LinkedList();
|
||||
list.add(new Integer(1));
|
||||
list.add(new Integer(2));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/AbstractTestIterator.java,v 1.4 2003/11/08 18:46:57 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/AbstractTestIterator.java,v 1.5 2003/11/18 22:37:14 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -71,7 +71,7 @@ import org.apache.commons.collections.AbstractTestObject;
|
|||
* overriding the supportsXxx() methods if necessary.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.4 $ $Date: 2003/11/08 18:46:57 $
|
||||
* @version $Revision: 1.5 $ $Date: 2003/11/18 22:37:14 $
|
||||
*
|
||||
* @author Morgan Delagrange
|
||||
* @author Stephen Colebourne
|
||||
|
@ -93,21 +93,21 @@ public abstract class AbstractTestIterator extends AbstractTestObject {
|
|||
*
|
||||
* @return an empty iterator
|
||||
*/
|
||||
protected abstract Iterator makeEmptyIterator();
|
||||
public abstract Iterator makeEmptyIterator();
|
||||
|
||||
/**
|
||||
* Implement this method to return an iterator over a collection with elements.
|
||||
*
|
||||
* @return a full iterator
|
||||
*/
|
||||
protected abstract Iterator makeFullIterator();
|
||||
public abstract Iterator makeFullIterator();
|
||||
|
||||
/**
|
||||
* Implements the abstract superclass method to return the full iterator.
|
||||
*
|
||||
* @return a full iterator
|
||||
*/
|
||||
protected Object makeObject() {
|
||||
public Object makeObject() {
|
||||
return makeFullIterator();
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ public abstract class AbstractTestIterator extends AbstractTestObject {
|
|||
*
|
||||
* @return true if Iterator can be empty
|
||||
*/
|
||||
protected boolean supportsEmptyIterator() {
|
||||
public boolean supportsEmptyIterator() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ public abstract class AbstractTestIterator extends AbstractTestObject {
|
|||
*
|
||||
* @return true if Iterator can be full
|
||||
*/
|
||||
protected boolean supportsFullIterator() {
|
||||
public boolean supportsFullIterator() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -137,14 +137,14 @@ public abstract class AbstractTestIterator extends AbstractTestObject {
|
|||
*
|
||||
* @return true if Iterator supports remove
|
||||
*/
|
||||
protected boolean supportsRemove() {
|
||||
public boolean supportsRemove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows subclasses to add complex cross verification
|
||||
*/
|
||||
protected void verify() {
|
||||
public void verify() {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/AbstractTestListIterator.java,v 1.3 2003/10/09 20:18:25 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/AbstractTestListIterator.java,v 1.4 2003/11/18 22:37:13 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -71,7 +71,7 @@ import java.util.NoSuchElementException;
|
|||
* overriding the supportsXxx() methods if necessary.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.3 $ $Date: 2003/10/09 20:18:25 $
|
||||
* @version $Revision: 1.4 $ $Date: 2003/11/18 22:37:13 $
|
||||
*
|
||||
* @author Rodney Waldhoff
|
||||
* @author Stephen Colebourne
|
||||
|
@ -93,21 +93,21 @@ public abstract class AbstractTestListIterator extends AbstractTestIterator {
|
|||
*
|
||||
* @return an empty iterator
|
||||
*/
|
||||
protected abstract ListIterator makeEmptyListIterator();
|
||||
public abstract ListIterator makeEmptyListIterator();
|
||||
|
||||
/**
|
||||
* Implement this method to return a list iterator over a collection with elements.
|
||||
*
|
||||
* @return a full iterator
|
||||
*/
|
||||
protected abstract ListIterator makeFullListIterator();
|
||||
public abstract ListIterator makeFullListIterator();
|
||||
|
||||
/**
|
||||
* Implements the abstract superclass method to return the list iterator.
|
||||
*
|
||||
* @return an empty iterator
|
||||
*/
|
||||
protected Iterator makeEmptyIterator() {
|
||||
public Iterator makeEmptyIterator() {
|
||||
return makeEmptyListIterator();
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ public abstract class AbstractTestListIterator extends AbstractTestIterator {
|
|||
*
|
||||
* @return a full iterator
|
||||
*/
|
||||
protected Iterator makeFullIterator() {
|
||||
public Iterator makeFullIterator() {
|
||||
return makeFullListIterator();
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ public abstract class AbstractTestListIterator extends AbstractTestIterator {
|
|||
*
|
||||
* @return true if Iterator supports add
|
||||
*/
|
||||
protected boolean supportsAdd() {
|
||||
public boolean supportsAdd() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ public abstract class AbstractTestListIterator extends AbstractTestIterator {
|
|||
*
|
||||
* @return true if Iterator supports set
|
||||
*/
|
||||
protected boolean supportsSet() {
|
||||
public boolean supportsSet() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ public abstract class AbstractTestListIterator extends AbstractTestIterator {
|
|||
* The value to be used in the add and set tests.
|
||||
* Default is null.
|
||||
*/
|
||||
protected Object addSetValue() {
|
||||
public Object addSetValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/AbstractTestMapIterator.java,v 1.3 2003/11/08 18:46:57 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/AbstractTestMapIterator.java,v 1.4 2003/11/18 22:37:14 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -72,7 +72,7 @@ import java.util.Set;
|
|||
* overriding the supportsXxx() methods if necessary.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/08 18:46:57 $
|
||||
* @version $Revision: 1.4 $ $Date: 2003/11/18 22:37:14 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -93,14 +93,14 @@ public abstract class AbstractTestMapIterator extends AbstractTestIterator {
|
|||
*
|
||||
* @return an empty iterator
|
||||
*/
|
||||
protected abstract MapIterator makeEmptyMapIterator();
|
||||
public abstract MapIterator makeEmptyMapIterator();
|
||||
|
||||
/**
|
||||
* Implement this method to return a map iterator over a map with elements.
|
||||
*
|
||||
* @return a full iterator
|
||||
*/
|
||||
protected abstract MapIterator makeFullMapIterator();
|
||||
public abstract MapIterator makeFullMapIterator();
|
||||
|
||||
/**
|
||||
* Implement this method to return the map which contains the same data as the
|
||||
|
@ -108,7 +108,7 @@ public abstract class AbstractTestMapIterator extends AbstractTestIterator {
|
|||
*
|
||||
* @return a full map which can be updated
|
||||
*/
|
||||
protected abstract Map getMap();
|
||||
public abstract Map getMap();
|
||||
|
||||
/**
|
||||
* Implement this method to return the confirmed map which contains the same
|
||||
|
@ -116,14 +116,14 @@ public abstract class AbstractTestMapIterator extends AbstractTestIterator {
|
|||
*
|
||||
* @return a full map which can be updated
|
||||
*/
|
||||
protected abstract Map getConfirmedMap();
|
||||
public abstract Map getConfirmedMap();
|
||||
|
||||
/**
|
||||
* Implements the abstract superclass method to return the list iterator.
|
||||
*
|
||||
* @return an empty iterator
|
||||
*/
|
||||
protected final Iterator makeEmptyIterator() {
|
||||
public final Iterator makeEmptyIterator() {
|
||||
return makeEmptyMapIterator();
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ public abstract class AbstractTestMapIterator extends AbstractTestIterator {
|
|||
*
|
||||
* @return a full iterator
|
||||
*/
|
||||
protected final Iterator makeFullIterator() {
|
||||
public final Iterator makeFullIterator() {
|
||||
return makeFullMapIterator();
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ public abstract class AbstractTestMapIterator extends AbstractTestIterator {
|
|||
*
|
||||
* @return true if Iterator supports set
|
||||
*/
|
||||
protected boolean supportsSetValue() {
|
||||
public boolean supportsSetValue() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ public abstract class AbstractTestMapIterator extends AbstractTestIterator {
|
|||
* The values to be used in the add and set tests.
|
||||
* Default is two strings.
|
||||
*/
|
||||
protected Object[] addSetValues() {
|
||||
public Object[] addSetValues() {
|
||||
return new Object[] {"A", "B"};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestUnmodifiableMapIterator.java,v 1.3 2003/11/16 20:35:47 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestUnmodifiableMapIterator.java,v 1.4 2003/11/18 22:37:13 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -70,7 +70,7 @@ import org.apache.commons.collections.bidimap.DualHashBidiMap;
|
|||
/**
|
||||
* Tests the UnmodifiableMapIterator.
|
||||
*
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/16 20:35:47 $
|
||||
* @version $Revision: 1.4 $ $Date: 2003/11/18 22:37:13 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -92,7 +92,7 @@ public class TestUnmodifiableMapIterator extends AbstractTestMapIterator {
|
|||
return UnmodifiableMapIterator.decorate(((BidiMap) getMap()).mapIterator());
|
||||
}
|
||||
|
||||
protected Map getMap() {
|
||||
public Map getMap() {
|
||||
Map testMap = new DualHashBidiMap();
|
||||
testMap.put("A", "a");
|
||||
testMap.put("B", "b");
|
||||
|
@ -100,7 +100,7 @@ public class TestUnmodifiableMapIterator extends AbstractTestMapIterator {
|
|||
return testMap;
|
||||
}
|
||||
|
||||
protected Map getConfirmedMap() {
|
||||
public Map getConfirmedMap() {
|
||||
Map testMap = new HashMap();
|
||||
testMap.put("A", "a");
|
||||
testMap.put("B", "b");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/list/AbstractTestList.java,v 1.1 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/list/AbstractTestList.java,v 1.2 2003/11/18 22:37:14 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -86,7 +86,7 @@ import org.apache.commons.collections.collection.AbstractTestCollection;
|
|||
* test case (method) your {@link List} fails or override one of the
|
||||
* protected methods from AbstractTestCollection.
|
||||
*
|
||||
* @version $Revision: 1.1 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/18 22:37:14 $
|
||||
*
|
||||
* @author Rodney Waldhoff
|
||||
* @author Paul Jack
|
||||
|
@ -112,7 +112,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
|
|||
* Default implementation returns true. Override if your collection
|
||||
* class does not support set.
|
||||
*/
|
||||
protected boolean isSetSupported() {
|
||||
public boolean isSetSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
|
|||
* Verifies that the test list implementation matches the confirmed list
|
||||
* implementation.
|
||||
*/
|
||||
protected void verify() {
|
||||
public void verify() {
|
||||
super.verify();
|
||||
|
||||
List list1 = getList();
|
||||
|
@ -153,7 +153,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
|
|||
/**
|
||||
* Returns an empty {@link ArrayList}.
|
||||
*/
|
||||
protected Collection makeConfirmedCollection() {
|
||||
public Collection makeConfirmedCollection() {
|
||||
ArrayList list = new ArrayList();
|
||||
return list;
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
|
|||
/**
|
||||
* Returns a full {@link ArrayList}.
|
||||
*/
|
||||
protected Collection makeConfirmedFullCollection() {
|
||||
public Collection makeConfirmedFullCollection() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.addAll(Arrays.asList(getFullElements()));
|
||||
return list;
|
||||
|
@ -172,14 +172,14 @@ public abstract class AbstractTestList extends AbstractTestCollection {
|
|||
*
|
||||
* @return an empty list for testing.
|
||||
*/
|
||||
protected abstract List makeEmptyList();
|
||||
public abstract List makeEmptyList();
|
||||
|
||||
/**
|
||||
* Return a new, full {@link List} to be used for testing.
|
||||
*
|
||||
* @return a full list for testing
|
||||
*/
|
||||
protected List makeFullList() {
|
||||
public List makeFullList() {
|
||||
// only works if list supports optional "addAll(Collection)"
|
||||
List list = makeEmptyList();
|
||||
list.addAll(Arrays.asList(getFullElements()));
|
||||
|
@ -191,7 +191,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
|
|||
*
|
||||
* @return an empty list to be used for testing
|
||||
*/
|
||||
protected final Collection makeCollection() {
|
||||
public final Collection makeCollection() {
|
||||
return makeEmptyList();
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
|
|||
*
|
||||
* @return a full list to be used for testing
|
||||
*/
|
||||
protected final Collection makeFullCollection() {
|
||||
public final Collection makeFullCollection() {
|
||||
return makeFullList();
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
|
|||
*
|
||||
* @return the collection field as a List
|
||||
*/
|
||||
protected List getList() {
|
||||
public List getList() {
|
||||
return (List) collection;
|
||||
}
|
||||
|
||||
|
@ -219,7 +219,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
|
|||
*
|
||||
* @return the confirmed field as a List
|
||||
*/
|
||||
protected List getConfirmedList() {
|
||||
public List getConfirmedList() {
|
||||
return (List) confirmed;
|
||||
}
|
||||
|
||||
|
@ -1028,7 +1028,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
|
|||
}
|
||||
|
||||
|
||||
static class BulkTestSubList extends AbstractTestList {
|
||||
public static class BulkTestSubList extends AbstractTestList {
|
||||
|
||||
private AbstractTestList outer;
|
||||
|
||||
|
@ -1039,48 +1039,48 @@ public abstract class AbstractTestList extends AbstractTestCollection {
|
|||
}
|
||||
|
||||
|
||||
protected Object[] getFullElements() {
|
||||
public Object[] getFullElements() {
|
||||
List l = Arrays.asList(outer.getFullElements());
|
||||
return l.subList(3, l.size() - 3).toArray();
|
||||
}
|
||||
|
||||
|
||||
protected Object[] getOtherElements() {
|
||||
public Object[] getOtherElements() {
|
||||
return outer.getOtherElements();
|
||||
}
|
||||
|
||||
|
||||
protected boolean isAddSupported() {
|
||||
public boolean isAddSupported() {
|
||||
return outer.isAddSupported();
|
||||
}
|
||||
|
||||
protected boolean isSetSupported() {
|
||||
public boolean isSetSupported() {
|
||||
return outer.isSetSupported();
|
||||
}
|
||||
|
||||
protected boolean isRemoveSupported() {
|
||||
public boolean isRemoveSupported() {
|
||||
return outer.isRemoveSupported();
|
||||
}
|
||||
|
||||
|
||||
protected List makeEmptyList() {
|
||||
public List makeEmptyList() {
|
||||
return outer.makeFullList().subList(4, 4);
|
||||
}
|
||||
|
||||
|
||||
protected List makeFullList() {
|
||||
public List makeFullList() {
|
||||
int size = getFullElements().length;
|
||||
return outer.makeFullList().subList(3, size - 3);
|
||||
}
|
||||
|
||||
|
||||
protected void resetEmpty() {
|
||||
public void resetEmpty() {
|
||||
outer.resetFull();
|
||||
this.collection = outer.getList().subList(4, 4);
|
||||
this.confirmed = outer.getConfirmedList().subList(4, 4);
|
||||
}
|
||||
|
||||
protected void resetFull() {
|
||||
public void resetFull() {
|
||||
outer.resetFull();
|
||||
int size = outer.confirmed.size();
|
||||
this.collection = outer.getList().subList(3, size - 3);
|
||||
|
@ -1088,7 +1088,7 @@ public abstract class AbstractTestList extends AbstractTestCollection {
|
|||
}
|
||||
|
||||
|
||||
protected void verify() {
|
||||
public void verify() {
|
||||
super.verify();
|
||||
outer.verify();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/list/TestFixedSizeList.java,v 1.2 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/list/TestFixedSizeList.java,v 1.3 2003/11/18 22:37:14 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -69,7 +69,7 @@ import junit.framework.TestSuite;
|
|||
* implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:14 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -92,17 +92,17 @@ public class TestFixedSizeList extends AbstractTestList {
|
|||
return FixedSizeList.decorate(new ArrayList());
|
||||
}
|
||||
|
||||
protected List makeFullList() {
|
||||
public List makeFullList() {
|
||||
List list = new ArrayList();
|
||||
list.addAll(Arrays.asList(getFullElements()));
|
||||
return FixedSizeList.decorate(list);
|
||||
}
|
||||
|
||||
protected boolean isAddSupported() {
|
||||
public boolean isAddSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isRemoveSupported() {
|
||||
public boolean isRemoveSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/list/TestPredicatedList.java,v 1.2 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/list/TestPredicatedList.java,v 1.3 2003/11/18 22:37:14 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -71,7 +71,7 @@ import org.apache.commons.collections.PredicateUtils;
|
|||
* {@link PredicatedList} implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:14 $
|
||||
*
|
||||
* @author Phil Steitz
|
||||
*/
|
||||
|
@ -102,7 +102,7 @@ public class TestPredicatedList extends AbstractTestList{
|
|||
return decorateList(new ArrayList(), truePredicate);
|
||||
}
|
||||
|
||||
protected Object[] getFullElements() {
|
||||
public Object[] getFullElements() {
|
||||
return new Object[] {"1", "3", "5", "7", "2", "4", "6"};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/list/TestSetUniqueList.java,v 1.2 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/list/TestSetUniqueList.java,v 1.3 2003/11/18 22:37:14 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -71,7 +71,7 @@ import junit.textui.TestRunner;
|
|||
* JUnit tests.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:14 $
|
||||
*
|
||||
* @author Matthew Hawthorne
|
||||
*/
|
||||
|
@ -90,7 +90,7 @@ public class TestSetUniqueList extends AbstractTestList {
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
protected List makeEmptyList() {
|
||||
public List makeEmptyList() {
|
||||
return new SetUniqueList(new ArrayList(), new HashSet());
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ public class TestSetUniqueList extends AbstractTestList {
|
|||
} catch (UnsupportedOperationException ex) {}
|
||||
}
|
||||
|
||||
protected Object[] getFullNonNullElements() {
|
||||
public Object[] getFullNonNullElements() {
|
||||
// override to avoid duplicate "One"
|
||||
return new Object[] {
|
||||
new String(""),
|
||||
|
@ -206,7 +206,7 @@ public class TestSetUniqueList extends AbstractTestList {
|
|||
}
|
||||
}
|
||||
|
||||
protected void verify() {
|
||||
public void verify() {
|
||||
super.verify();
|
||||
|
||||
if (extraVerify) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/list/TestTransformedList.java,v 1.2 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/list/TestTransformedList.java,v 1.3 2003/11/18 22:37:14 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -73,7 +73,7 @@ import org.apache.commons.collections.collection.TestTransformedCollection;
|
|||
* implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:14 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -96,7 +96,7 @@ public class TestTransformedList extends AbstractTestList {
|
|||
return new ArrayList();
|
||||
}
|
||||
|
||||
protected Collection makeConfirmedFullCollection() {
|
||||
public Collection makeConfirmedFullCollection() {
|
||||
List list = new ArrayList();
|
||||
list.addAll(Arrays.asList(getFullElements()));
|
||||
return list;
|
||||
|
@ -106,7 +106,7 @@ public class TestTransformedList extends AbstractTestList {
|
|||
return TransformedList.decorate(new ArrayList(), TestTransformedCollection.NOOP_TRANSFORMER);
|
||||
}
|
||||
|
||||
protected List makeFullList() {
|
||||
public List makeFullList() {
|
||||
List list = new ArrayList();
|
||||
list.addAll(Arrays.asList(getFullElements()));
|
||||
return TransformedList.decorate(list, TestTransformedCollection.NOOP_TRANSFORMER);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/list/TestUnmodifiableList.java,v 1.2 2003/11/16 22:15:09 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/list/TestUnmodifiableList.java,v 1.3 2003/11/18 22:37:14 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -72,7 +72,7 @@ import org.apache.commons.collections.map.TestPredicatedSortedMap;
|
|||
* {@link UnmodifiableList} implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:09 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:14 $
|
||||
*
|
||||
* @author Phil Steitz
|
||||
*/
|
||||
|
@ -102,15 +102,15 @@ public class TestUnmodifiableList extends AbstractTestList{
|
|||
return UnmodifiableList.decorate(list);
|
||||
}
|
||||
|
||||
protected boolean isSetSupported() {
|
||||
public boolean isSetSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isAddSupported() {
|
||||
public boolean isAddSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isRemoveSupported() {
|
||||
public boolean isRemoveSupported() {
|
||||
return false;
|
||||
}
|
||||
//--------------------------------------------------------------------
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/AbstractTestMap.java,v 1.1 2003/11/16 22:15:10 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/AbstractTestMap.java,v 1.2 2003/11/18 22:37:17 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -158,7 +158,7 @@ import org.apache.commons.collections.set.AbstractTestSet;
|
|||
* @author Rodney Waldhoff
|
||||
* @author Paul Jack
|
||||
* @author Stephen Colebourne
|
||||
* @version $Revision: 1.1 $ $Date: 2003/11/16 22:15:10 $
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/18 22:37:17 $
|
||||
*/
|
||||
public abstract class AbstractTestMap extends AbstractTestObject {
|
||||
|
||||
|
@ -204,7 +204,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
* Default implementation returns true.
|
||||
* Override if your collection class does not support put adding.
|
||||
*/
|
||||
protected boolean isPutAddSupported() {
|
||||
public boolean isPutAddSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
* Default implementation returns true.
|
||||
* Override if your collection class does not support put changing.
|
||||
*/
|
||||
protected boolean isPutChangeSupported() {
|
||||
public boolean isPutChangeSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
* Override if your collection class does not support setValue but does
|
||||
* support put changing.
|
||||
*/
|
||||
protected boolean isSetValueSupported() {
|
||||
public boolean isSetValueSupported() {
|
||||
return isPutChangeSupported();
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
* Default implementation returns true.
|
||||
* Override if your collection class does not support removal operations.
|
||||
*/
|
||||
protected boolean isRemoveSupported() {
|
||||
public boolean isRemoveSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
* Default implementation returns true.
|
||||
* Override if your collection class does not support null keys.
|
||||
*/
|
||||
protected boolean isAllowNullKey() {
|
||||
public boolean isAllowNullKey() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
* Default implementation returns true.
|
||||
* Override if your collection class does not support null values.
|
||||
*/
|
||||
protected boolean isAllowNullValue() {
|
||||
public boolean isAllowNullValue() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
* Default implementation returns true.
|
||||
* Override if your collection class does not support duplicate values.
|
||||
*/
|
||||
protected boolean isAllowDuplicateValues() {
|
||||
public boolean isAllowDuplicateValues() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -289,7 +289,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
* default implementation constructs a set of String keys, and includes a
|
||||
* single null key if {@link #isAllowNullKey()} returns <code>true</code>.
|
||||
*/
|
||||
protected Object[] getSampleKeys() {
|
||||
public Object[] getSampleKeys() {
|
||||
Object[] result = new Object[] {
|
||||
"blah", "foo", "bar", "baz", "tmp", "gosh", "golly", "gee",
|
||||
"hello", "goodbye", "we'll", "see", "you", "all", "again",
|
||||
|
@ -301,11 +301,11 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
}
|
||||
|
||||
|
||||
protected Object[] getOtherKeys() {
|
||||
public Object[] getOtherKeys() {
|
||||
return getOtherNonNullStringElements();
|
||||
}
|
||||
|
||||
protected Object[] getOtherValues() {
|
||||
public Object[] getOtherValues() {
|
||||
return getOtherNonNullStringElements();
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
* collection does not support heterogenous elements or the null element.
|
||||
* </p>
|
||||
*/
|
||||
protected Object[] getOtherNonNullStringElements() {
|
||||
public Object[] getOtherNonNullStringElements() {
|
||||
return new Object[] {
|
||||
"For","then","despite",/* of */"space","I","would","be","brought",
|
||||
"From","limits","far","remote","where","thou","dost","stay"
|
||||
|
@ -333,7 +333,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
* two values that are the same if {@link #isAllowDuplicateValues()} returns
|
||||
* <code>true</code>.
|
||||
*/
|
||||
protected Object[] getSampleValues() {
|
||||
public Object[] getSampleValues() {
|
||||
Object[] result = new Object[] {
|
||||
"blahv", "foov", "barv", "bazv", "tmpv", "goshv", "gollyv", "geev",
|
||||
"hellov", "goodbyev", "we'llv", "seev", "youv", "allv", "againv",
|
||||
|
@ -355,7 +355,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
* that are the same if {@link #isAllowDuplicateValues()} returns
|
||||
* <code>true</code>.
|
||||
*/
|
||||
protected Object[] getNewSampleValues() {
|
||||
public Object[] getNewSampleValues() {
|
||||
Object[] result = new Object[] {
|
||||
(isAllowNullValue() && isAllowDuplicateValues()) ? null : "newnonnullvalue",
|
||||
"newvalue",
|
||||
|
@ -371,7 +371,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
* Helper method to add all the mappings described by {@link
|
||||
* #getSampleKeys()} and {@link #getSampleValues()}.
|
||||
*/
|
||||
protected void addSampleMappings(Map m) {
|
||||
public void addSampleMappings(Map m) {
|
||||
|
||||
Object[] keys = getSampleKeys();
|
||||
Object[] values = getSampleValues();
|
||||
|
@ -405,7 +405,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
*
|
||||
* @return the map to be tested
|
||||
*/
|
||||
protected abstract Map makeEmptyMap();
|
||||
public abstract Map makeEmptyMap();
|
||||
|
||||
/**
|
||||
* Return a new, populated map. The mappings in the map should match the
|
||||
|
@ -416,7 +416,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
*
|
||||
* @return the map to be tested
|
||||
*/
|
||||
protected Map makeFullMap() {
|
||||
public Map makeFullMap() {
|
||||
Map m = makeEmptyMap();
|
||||
addSampleMappings(m);
|
||||
return m;
|
||||
|
@ -436,14 +436,14 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
*
|
||||
* @return a map that is known to be valid
|
||||
*/
|
||||
protected Map makeConfirmedMap() {
|
||||
public Map makeConfirmedMap() {
|
||||
return new HashMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Map Entry that is independent of the first and the map.
|
||||
*/
|
||||
protected Map.Entry cloneMapEntry(Map.Entry entry) {
|
||||
public Map.Entry cloneMapEntry(Map.Entry entry) {
|
||||
HashMap map = new HashMap();
|
||||
map.put(entry.getKey(), entry.getValue());
|
||||
return (Map.Entry) map.entrySet().iterator().next();
|
||||
|
@ -452,7 +452,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
/**
|
||||
* Gets the compatability version, needed for package access.
|
||||
*/
|
||||
protected String getCompatibilityVersion() {
|
||||
public String getCompatibilityVersion() {
|
||||
return super.getCompatibilityVersion();
|
||||
}
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -1130,49 +1130,49 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
}
|
||||
|
||||
// Have to implement manually; entrySet doesn't support addAll
|
||||
protected Object[] getFullElements() {
|
||||
public Object[] getFullElements() {
|
||||
Object[] k = getSampleKeys();
|
||||
Object[] v = getSampleValues();
|
||||
return makeEntryArray(k, v);
|
||||
}
|
||||
|
||||
// Have to implement manually; entrySet doesn't support addAll
|
||||
protected Object[] getOtherElements() {
|
||||
public Object[] getOtherElements() {
|
||||
Object[] k = getOtherKeys();
|
||||
Object[] v = getOtherValues();
|
||||
return makeEntryArray(k, v);
|
||||
}
|
||||
|
||||
protected Set makeEmptySet() {
|
||||
public Set makeEmptySet() {
|
||||
return makeEmptyMap().entrySet();
|
||||
}
|
||||
|
||||
protected Set makeFullSet() {
|
||||
public Set makeFullSet() {
|
||||
return makeFullMap().entrySet();
|
||||
}
|
||||
|
||||
protected boolean isAddSupported() {
|
||||
public boolean isAddSupported() {
|
||||
// Collection views don't support add operations.
|
||||
return false;
|
||||
}
|
||||
protected boolean isRemoveSupported() {
|
||||
public boolean isRemoveSupported() {
|
||||
// Entry set should only support remove if map does
|
||||
return AbstractTestMap.this.isRemoveSupported();
|
||||
}
|
||||
protected boolean supportsEmptyCollections() {
|
||||
public boolean supportsEmptyCollections() {
|
||||
return AbstractTestMap.this.supportsEmptyCollections();
|
||||
}
|
||||
protected boolean supportsFullCollections() {
|
||||
public boolean supportsFullCollections() {
|
||||
return AbstractTestMap.this.supportsFullCollections();
|
||||
}
|
||||
|
||||
protected void resetFull() {
|
||||
public void resetFull() {
|
||||
AbstractTestMap.this.resetFull();
|
||||
collection = map.entrySet();
|
||||
TestMapEntrySet.this.confirmed = AbstractTestMap.this.confirmed.entrySet();
|
||||
}
|
||||
|
||||
protected void resetEmpty() {
|
||||
public void resetEmpty() {
|
||||
AbstractTestMap.this.resetEmpty();
|
||||
collection = map.entrySet();
|
||||
TestMapEntrySet.this.confirmed = AbstractTestMap.this.confirmed.entrySet();
|
||||
|
@ -1244,7 +1244,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
verify();
|
||||
}
|
||||
|
||||
protected Map.Entry getEntry(Iterator itConfirmed, Object key) {
|
||||
public Map.Entry getEntry(Iterator itConfirmed, Object key) {
|
||||
Map.Entry entry = null;
|
||||
while (itConfirmed.hasNext()) {
|
||||
Map.Entry temp = (Map.Entry) itConfirmed.next();
|
||||
|
@ -1262,7 +1262,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
return entry;
|
||||
}
|
||||
|
||||
protected void verify() {
|
||||
public void verify() {
|
||||
super.verify();
|
||||
AbstractTestMap.this.verify();
|
||||
}
|
||||
|
@ -1285,51 +1285,51 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
public TestMapKeySet() {
|
||||
super("");
|
||||
}
|
||||
protected Object[] getFullElements() {
|
||||
public Object[] getFullElements() {
|
||||
return getSampleKeys();
|
||||
}
|
||||
|
||||
protected Object[] getOtherElements() {
|
||||
public Object[] getOtherElements() {
|
||||
return getOtherKeys();
|
||||
}
|
||||
|
||||
protected Set makeEmptySet() {
|
||||
public Set makeEmptySet() {
|
||||
return makeEmptyMap().keySet();
|
||||
}
|
||||
|
||||
protected Set makeFullSet() {
|
||||
public Set makeFullSet() {
|
||||
return makeFullMap().keySet();
|
||||
}
|
||||
|
||||
protected boolean isNullSupported() {
|
||||
public boolean isNullSupported() {
|
||||
return AbstractTestMap.this.isAllowNullKey();
|
||||
}
|
||||
protected boolean isAddSupported() {
|
||||
public boolean isAddSupported() {
|
||||
return false;
|
||||
}
|
||||
protected boolean isRemoveSupported() {
|
||||
public boolean isRemoveSupported() {
|
||||
return AbstractTestMap.this.isRemoveSupported();
|
||||
}
|
||||
protected boolean supportsEmptyCollections() {
|
||||
public boolean supportsEmptyCollections() {
|
||||
return AbstractTestMap.this.supportsEmptyCollections();
|
||||
}
|
||||
protected boolean supportsFullCollections() {
|
||||
public boolean supportsFullCollections() {
|
||||
return AbstractTestMap.this.supportsFullCollections();
|
||||
}
|
||||
|
||||
protected void resetEmpty() {
|
||||
public void resetEmpty() {
|
||||
AbstractTestMap.this.resetEmpty();
|
||||
collection = map.keySet();
|
||||
TestMapKeySet.this.confirmed = AbstractTestMap.this.confirmed.keySet();
|
||||
}
|
||||
|
||||
protected void resetFull() {
|
||||
public void resetFull() {
|
||||
AbstractTestMap.this.resetFull();
|
||||
collection = map.keySet();
|
||||
TestMapKeySet.this.confirmed = AbstractTestMap.this.confirmed.keySet();
|
||||
}
|
||||
|
||||
protected void verify() {
|
||||
public void verify() {
|
||||
super.verify();
|
||||
AbstractTestMap.this.verify();
|
||||
}
|
||||
|
@ -1354,67 +1354,67 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
super("");
|
||||
}
|
||||
|
||||
protected Object[] getFullElements() {
|
||||
public Object[] getFullElements() {
|
||||
return getSampleValues();
|
||||
}
|
||||
|
||||
protected Object[] getOtherElements() {
|
||||
public Object[] getOtherElements() {
|
||||
return getOtherValues();
|
||||
}
|
||||
|
||||
protected Collection makeCollection() {
|
||||
public Collection makeCollection() {
|
||||
return makeEmptyMap().values();
|
||||
}
|
||||
|
||||
protected Collection makeFullCollection() {
|
||||
public Collection makeFullCollection() {
|
||||
return makeFullMap().values();
|
||||
}
|
||||
|
||||
protected boolean isNullSupported() {
|
||||
public boolean isNullSupported() {
|
||||
return AbstractTestMap.this.isAllowNullKey();
|
||||
}
|
||||
protected boolean isAddSupported() {
|
||||
public boolean isAddSupported() {
|
||||
return false;
|
||||
}
|
||||
protected boolean isRemoveSupported() {
|
||||
public boolean isRemoveSupported() {
|
||||
return AbstractTestMap.this.isRemoveSupported();
|
||||
}
|
||||
protected boolean supportsEmptyCollections() {
|
||||
public boolean supportsEmptyCollections() {
|
||||
return AbstractTestMap.this.supportsEmptyCollections();
|
||||
}
|
||||
protected boolean supportsFullCollections() {
|
||||
public boolean supportsFullCollections() {
|
||||
return AbstractTestMap.this.supportsFullCollections();
|
||||
}
|
||||
|
||||
protected boolean areEqualElementsDistinguishable() {
|
||||
public boolean areEqualElementsDistinguishable() {
|
||||
// equal values are associated with different keys, so they are
|
||||
// distinguishable.
|
||||
return true;
|
||||
}
|
||||
|
||||
protected Collection makeConfirmedCollection() {
|
||||
public Collection makeConfirmedCollection() {
|
||||
// never gets called, reset methods are overridden
|
||||
return null;
|
||||
}
|
||||
|
||||
protected Collection makeConfirmedFullCollection() {
|
||||
public Collection makeConfirmedFullCollection() {
|
||||
// never gets called, reset methods are overridden
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void resetFull() {
|
||||
public void resetFull() {
|
||||
AbstractTestMap.this.resetFull();
|
||||
collection = map.values();
|
||||
TestMapValues.this.confirmed = AbstractTestMap.this.confirmed.values();
|
||||
}
|
||||
|
||||
protected void resetEmpty() {
|
||||
public void resetEmpty() {
|
||||
AbstractTestMap.this.resetEmpty();
|
||||
collection = map.values();
|
||||
TestMapValues.this.confirmed = AbstractTestMap.this.confirmed.values();
|
||||
}
|
||||
|
||||
protected void verify() {
|
||||
public void verify() {
|
||||
super.verify();
|
||||
AbstractTestMap.this.verify();
|
||||
}
|
||||
|
@ -1429,7 +1429,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
* Resets the {@link #map}, {@link #entrySet}, {@link #keySet},
|
||||
* {@link #values} and {@link #confirmed} fields to empty.
|
||||
*/
|
||||
protected void resetEmpty() {
|
||||
public void resetEmpty() {
|
||||
this.map = makeEmptyMap();
|
||||
views();
|
||||
this.confirmed = makeConfirmedMap();
|
||||
|
@ -1439,7 +1439,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
* Resets the {@link #map}, {@link #entrySet}, {@link #keySet},
|
||||
* {@link #values} and {@link #confirmed} fields to full.
|
||||
*/
|
||||
protected void resetFull() {
|
||||
public void resetFull() {
|
||||
this.map = makeFullMap();
|
||||
views();
|
||||
this.confirmed = makeConfirmedMap();
|
||||
|
@ -1471,14 +1471,14 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
* compared; and <Code>containsAll</Code> tests are run on the
|
||||
* collection views.
|
||||
*/
|
||||
protected void verify() {
|
||||
public void verify() {
|
||||
verifyMap();
|
||||
verifyEntrySet();
|
||||
verifyKeySet();
|
||||
verifyValues();
|
||||
}
|
||||
|
||||
protected void verifyMap() {
|
||||
public void verifyMap() {
|
||||
int size = confirmed.size();
|
||||
boolean empty = confirmed.isEmpty();
|
||||
assertEquals("Map should be same size as HashMap",
|
||||
|
@ -1498,7 +1498,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
// causing LRUMap to change).
|
||||
}
|
||||
|
||||
protected void verifyEntrySet() {
|
||||
public void verifyEntrySet() {
|
||||
int size = confirmed.size();
|
||||
boolean empty = confirmed.isEmpty();
|
||||
assertEquals("entrySet should be same size as HashMap's" +
|
||||
|
@ -1517,7 +1517,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
confirmed.entrySet(), entrySet);
|
||||
}
|
||||
|
||||
protected void verifyKeySet() {
|
||||
public void verifyKeySet() {
|
||||
int size = confirmed.size();
|
||||
boolean empty = confirmed.isEmpty();
|
||||
assertEquals("keySet should be same size as HashMap's" +
|
||||
|
@ -1536,7 +1536,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
confirmed.keySet(), keySet);
|
||||
}
|
||||
|
||||
protected void verifyValues() {
|
||||
public void verifyValues() {
|
||||
List known = new ArrayList(confirmed.values());
|
||||
List test = new ArrayList(values);
|
||||
|
||||
|
@ -1566,7 +1566,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
|
|||
/**
|
||||
* Erases any leftover instance variables by setting them to null.
|
||||
*/
|
||||
protected void tearDown() throws Exception {
|
||||
public void tearDown() throws Exception {
|
||||
map = null;
|
||||
keySet = null;
|
||||
entrySet = null;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/AbstractTestSortedMap.java,v 1.1 2003/11/16 22:15:11 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/AbstractTestSortedMap.java,v 1.2 2003/11/18 22:37:17 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -70,7 +70,7 @@ import org.apache.commons.collections.BulkTest;
|
|||
/**
|
||||
* Abstract test class for {@link java.util.SortedMap} methods and contracts.
|
||||
*
|
||||
* @version $Revision: 1.1 $ $Date: 2003/11/16 22:15:11 $
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/18 22:37:17 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -91,7 +91,7 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap {
|
|||
*
|
||||
* @return false
|
||||
*/
|
||||
protected boolean isAllowNullKey() {
|
||||
public boolean isAllowNullKey() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap {
|
|||
*
|
||||
* @return a map that is known to be valid
|
||||
*/
|
||||
protected Map makeConfirmedMap() {
|
||||
public Map makeConfirmedMap() {
|
||||
return new TreeMap();
|
||||
}
|
||||
|
||||
|
@ -147,17 +147,17 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap {
|
|||
super(name);
|
||||
this.main = main;
|
||||
}
|
||||
protected void resetEmpty() {
|
||||
public void resetEmpty() {
|
||||
// needed to init verify correctly
|
||||
main.resetEmpty();
|
||||
super.resetEmpty();
|
||||
}
|
||||
protected void resetFull() {
|
||||
public void resetFull() {
|
||||
// needed to init verify correctly
|
||||
main.resetFull();
|
||||
super.resetFull();
|
||||
}
|
||||
protected void verify() {
|
||||
public void verify() {
|
||||
// cross verify changes on view with changes on main map
|
||||
super.verify();
|
||||
main.verify();
|
||||
|
@ -172,38 +172,38 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap {
|
|||
return null; // block infinite recursion
|
||||
}
|
||||
|
||||
protected Object[] getSampleKeys() {
|
||||
public Object[] getSampleKeys() {
|
||||
return subSortedKeys.toArray();
|
||||
}
|
||||
protected Object[] getSampleValues() {
|
||||
public Object[] getSampleValues() {
|
||||
return subSortedValues.toArray();
|
||||
}
|
||||
protected Object[] getNewSampleValues() {
|
||||
public Object[] getNewSampleValues() {
|
||||
return subSortedNewValues.toArray();
|
||||
}
|
||||
|
||||
protected String getCompatibilityVersion() {
|
||||
public String getCompatibilityVersion() {
|
||||
return main.getCompatibilityVersion();
|
||||
}
|
||||
protected boolean isAllowNullKey() {
|
||||
public boolean isAllowNullKey() {
|
||||
return main.isAllowNullKey();
|
||||
}
|
||||
protected boolean isAllowNullValue() {
|
||||
public boolean isAllowNullValue() {
|
||||
return main.isAllowNullValue();
|
||||
}
|
||||
protected boolean isPutAddSupported() {
|
||||
public boolean isPutAddSupported() {
|
||||
return main.isPutAddSupported();
|
||||
}
|
||||
protected boolean isPutChangeSupported() {
|
||||
public boolean isPutChangeSupported() {
|
||||
return main.isPutChangeSupported();
|
||||
}
|
||||
protected boolean isRemoveSupported() {
|
||||
public boolean isRemoveSupported() {
|
||||
return main.isRemoveSupported();
|
||||
}
|
||||
protected boolean supportsEmptyCollections() {
|
||||
public boolean supportsEmptyCollections() {
|
||||
return false;
|
||||
}
|
||||
protected boolean supportsFullCollections() {
|
||||
public boolean supportsFullCollections() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -225,11 +225,11 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap {
|
|||
this.subSortedValues.subList(SUBSIZE, this.subSortedValues.size()).clear();
|
||||
this.subSortedNewValues.addAll(Arrays.asList(main.getNewSampleValues()).subList(0, SUBSIZE));
|
||||
}
|
||||
protected Map makeEmptyMap() {
|
||||
public Map makeEmptyMap() {
|
||||
// done this way so toKey is correctly set in the returned map
|
||||
return ((SortedMap) main.makeEmptyMap()).headMap(toKey);
|
||||
}
|
||||
protected Map makeFullMap() {
|
||||
public Map makeFullMap() {
|
||||
return ((SortedMap) main.makeFullMap()).headMap(toKey);
|
||||
}
|
||||
public void testHeadMapOutOfRange() {
|
||||
|
@ -262,11 +262,11 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap {
|
|||
this.subSortedValues.subList(0, this.subSortedValues.size() - SUBSIZE).clear();
|
||||
this.subSortedNewValues.addAll(Arrays.asList(main.getNewSampleValues()).subList(0, SUBSIZE));
|
||||
}
|
||||
protected Map makeEmptyMap() {
|
||||
public Map makeEmptyMap() {
|
||||
// done this way so toKey is correctly set in the returned map
|
||||
return ((SortedMap) main.makeEmptyMap()).tailMap(fromKey);
|
||||
}
|
||||
protected Map makeFullMap() {
|
||||
public Map makeFullMap() {
|
||||
return ((SortedMap) main.makeFullMap()).tailMap(fromKey);
|
||||
}
|
||||
public void testTailMapOutOfRange() {
|
||||
|
@ -306,11 +306,11 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap {
|
|||
SUBSIZE, this.main.getNewSampleValues().length - SUBSIZE));
|
||||
}
|
||||
|
||||
protected Map makeEmptyMap() {
|
||||
public Map makeEmptyMap() {
|
||||
// done this way so toKey is correctly set in the returned map
|
||||
return ((SortedMap) main.makeEmptyMap()).subMap(fromKey, toKey);
|
||||
}
|
||||
protected Map makeFullMap() {
|
||||
public Map makeFullMap() {
|
||||
return ((SortedMap) main.makeFullMap()).subMap(fromKey, toKey);
|
||||
}
|
||||
public void testSubMapOutOfRange() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java,v 1.2 2003/11/16 22:15:11 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java,v 1.3 2003/11/18 22:37:17 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -68,7 +68,7 @@ import junit.framework.TestSuite;
|
|||
* implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:11 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:17 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -87,21 +87,21 @@ public class TestFixedSizeMap extends AbstractTestMap {
|
|||
junit.textui.TestRunner.main(testCaseName);
|
||||
}
|
||||
|
||||
protected Map makeEmptyMap() {
|
||||
public Map makeEmptyMap() {
|
||||
return FixedSizeMap.decorate(new HashMap());
|
||||
}
|
||||
|
||||
protected Map makeFullMap() {
|
||||
public Map makeFullMap() {
|
||||
Map map = new HashMap();
|
||||
addSampleMappings(map);
|
||||
return FixedSizeMap.decorate(map);
|
||||
}
|
||||
|
||||
protected boolean isPutAddSupported() {
|
||||
public boolean isPutAddSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isRemoveSupported() {
|
||||
public boolean isRemoveSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestFixedSizeSortedMap.java,v 1.2 2003/11/16 22:15:11 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestFixedSizeSortedMap.java,v 1.3 2003/11/18 22:37:17 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -70,7 +70,7 @@ import org.apache.commons.collections.BulkTest;
|
|||
* implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:11 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:17 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -93,17 +93,17 @@ public class TestFixedSizeSortedMap extends AbstractTestSortedMap {
|
|||
return FixedSizeSortedMap.decorate(new TreeMap());
|
||||
}
|
||||
|
||||
protected Map makeFullMap() {
|
||||
public Map makeFullMap() {
|
||||
SortedMap map = new TreeMap();
|
||||
addSampleMappings(map);
|
||||
return FixedSizeSortedMap.decorate(map);
|
||||
}
|
||||
|
||||
protected boolean isPutAddSupported() {
|
||||
public boolean isPutAddSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isRemoveSupported() {
|
||||
public boolean isRemoveSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestLazyMap.java,v 1.2 2003/11/16 22:15:11 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestLazyMap.java,v 1.3 2003/11/18 22:37:17 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -71,7 +71,7 @@ import org.apache.commons.collections.FactoryUtils;
|
|||
* {@link LazyMap} implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:11 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:17 $
|
||||
*
|
||||
* @author Phil Steitz
|
||||
*/
|
||||
|
@ -99,7 +99,7 @@ public class TestLazyMap extends AbstractTestMap {
|
|||
return LazyMap.decorate(map, factory);
|
||||
}
|
||||
|
||||
protected Map makeEmptyMap() {
|
||||
public Map makeEmptyMap() {
|
||||
return decorateMap(new HashMap(), nullFactory);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestLazySortedMap.java,v 1.1 2003/11/16 00:05:46 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestLazySortedMap.java,v 1.2 2003/11/18 22:37:17 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -74,7 +74,7 @@ import org.apache.commons.collections.TransformerUtils;
|
|||
* {@link LazySortedMap} implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.1 $ $Date: 2003/11/16 00:05:46 $
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/18 22:37:17 $
|
||||
*
|
||||
* @author Phil Steitz
|
||||
*/
|
||||
|
@ -103,7 +103,7 @@ public class TestLazySortedMap extends TestLazyMap {
|
|||
return decorateMap(new TreeMap(), nullFactory);
|
||||
}
|
||||
|
||||
protected boolean isAllowNullKey() {
|
||||
public boolean isAllowNullKey() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestListOrderedMap.java,v 1.2 2003/11/16 22:15:11 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestListOrderedMap.java,v 1.3 2003/11/18 22:37:17 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -75,7 +75,7 @@ import org.apache.commons.collections.iterators.MapIterator;
|
|||
* implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:11 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:17 $
|
||||
*
|
||||
* @author Henri Yandell
|
||||
* @author Stephen Colebourne
|
||||
|
@ -109,39 +109,35 @@ public class TestListOrderedMap extends AbstractTestMap {
|
|||
super("TestOrderedMapIterator");
|
||||
}
|
||||
|
||||
protected Object addSetValue() {
|
||||
return TestListOrderedMap.this.getNewSampleValues()[0];
|
||||
}
|
||||
|
||||
protected boolean supportsRemove() {
|
||||
public boolean supportsRemove() {
|
||||
return TestListOrderedMap.this.isRemoveSupported();
|
||||
}
|
||||
|
||||
protected boolean supportsSetValue() {
|
||||
public boolean supportsSetValue() {
|
||||
return TestListOrderedMap.this.isSetValueSupported();
|
||||
}
|
||||
|
||||
protected MapIterator makeEmptyMapIterator() {
|
||||
public MapIterator makeEmptyMapIterator() {
|
||||
resetEmpty();
|
||||
return ((ListOrderedMap) TestListOrderedMap.this.map).mapIterator();
|
||||
}
|
||||
|
||||
protected MapIterator makeFullMapIterator() {
|
||||
public MapIterator makeFullMapIterator() {
|
||||
resetFull();
|
||||
return ((ListOrderedMap) TestListOrderedMap.this.map).mapIterator();
|
||||
}
|
||||
|
||||
protected Map getMap() {
|
||||
public Map getMap() {
|
||||
// assumes makeFullMapIterator() called first
|
||||
return TestListOrderedMap.this.map;
|
||||
}
|
||||
|
||||
protected Map getConfirmedMap() {
|
||||
public Map getConfirmedMap() {
|
||||
// assumes makeFullMapIterator() called first
|
||||
return TestListOrderedMap.this.confirmed;
|
||||
}
|
||||
|
||||
protected void verify() {
|
||||
public void verify() {
|
||||
super.verify();
|
||||
TestListOrderedMap.this.verify();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestPredicatedMap.java,v 1.2 2003/11/16 22:15:11 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestPredicatedMap.java,v 1.3 2003/11/18 22:37:17 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -72,7 +72,7 @@ import org.apache.commons.collections.PredicateUtils;
|
|||
* {@link PredicatedMap} implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:11 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:17 $
|
||||
*
|
||||
* @author Phil Steitz
|
||||
*/
|
||||
|
@ -100,7 +100,7 @@ public class TestPredicatedMap extends AbstractTestMap{
|
|||
return PredicatedMap.decorate(map, keyPredicate, valuePredicate);
|
||||
}
|
||||
|
||||
protected Map makeEmptyMap() {
|
||||
public Map makeEmptyMap() {
|
||||
return decorateMap(new HashMap(), truePredicate, truePredicate);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestPredicatedSortedMap.java,v 1.1 2003/11/16 00:05:46 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestPredicatedSortedMap.java,v 1.2 2003/11/18 22:37:17 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -72,7 +72,7 @@ import org.apache.commons.collections.Predicate;
|
|||
* {@link PredicatedSortedMap} implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.1 $ $Date: 2003/11/16 00:05:46 $
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/18 22:37:17 $
|
||||
*
|
||||
* @author Phil Steitz
|
||||
*/
|
||||
|
@ -106,7 +106,7 @@ public class TestPredicatedSortedMap extends TestPredicatedMap{
|
|||
return decorateMap(new TreeMap(), testPredicate, testPredicate);
|
||||
}
|
||||
|
||||
protected boolean isAllowNullKey() {
|
||||
public boolean isAllowNullKey() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestTransformedMap.java,v 1.2 2003/11/16 22:15:11 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestTransformedMap.java,v 1.3 2003/11/18 22:37:17 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -71,7 +71,7 @@ import org.apache.commons.collections.collection.TestTransformedCollection;
|
|||
* implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:11 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:17 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -90,7 +90,7 @@ public class TestTransformedMap extends AbstractTestMap {
|
|||
junit.textui.TestRunner.main(testCaseName);
|
||||
}
|
||||
|
||||
protected Map makeEmptyMap() {
|
||||
public Map makeEmptyMap() {
|
||||
return TransformedMap.decorate(new HashMap(), TestTransformedCollection.NOOP_TRANSFORMER, TestTransformedCollection.NOOP_TRANSFORMER);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestUnmodifiableMap.java,v 1.2 2003/11/16 22:15:10 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestUnmodifiableMap.java,v 1.3 2003/11/18 22:37:17 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -72,7 +72,7 @@ import junit.framework.TestSuite;
|
|||
* {@link UnmodifiableMap} implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/16 22:15:10 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:17 $
|
||||
*
|
||||
* @author Phil Steitz
|
||||
*/
|
||||
|
@ -93,23 +93,23 @@ public class TestUnmodifiableMap extends AbstractTestMap{
|
|||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
protected Map makeEmptyMap() {
|
||||
public Map makeEmptyMap() {
|
||||
return UnmodifiableMap.decorate(new HashMap());
|
||||
}
|
||||
|
||||
protected boolean isPutChangeSupported() {
|
||||
public boolean isPutChangeSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isPutAddSupported() {
|
||||
public boolean isPutAddSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isRemoveSupported() {
|
||||
public boolean isRemoveSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected Map makeFullMap() {
|
||||
public Map makeFullMap() {
|
||||
Map m = new HashMap();
|
||||
addSampleMappings(m);
|
||||
return UnmodifiableMap.decorate(m);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/observed/Attic/TestObservableBag.java,v 1.4 2003/11/16 22:15:12 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/observed/Attic/TestObservableBag.java,v 1.5 2003/11/18 22:37:17 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -69,7 +69,7 @@ import org.apache.commons.collections.bag.AbstractTestBag;
|
|||
* {@link ObservableBag} implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.4 $ $Date: 2003/11/16 22:15:12 $
|
||||
* @version $Revision: 1.5 $ $Date: 2003/11/18 22:37:17 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -89,7 +89,7 @@ public class TestObservableBag extends AbstractTestBag implements ObservedTestHe
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
protected Bag makeBag() {
|
||||
public Bag makeBag() {
|
||||
return ObservableBag.decorate(new HashBag(), ObservedTestHelper.LISTENER);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/observed/Attic/TestObservableBuffer.java,v 1.4 2003/11/16 22:15:11 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/observed/Attic/TestObservableBuffer.java,v 1.5 2003/11/18 22:37:17 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -72,7 +72,7 @@ import org.apache.commons.collections.collection.AbstractTestCollection;
|
|||
* {@link ObservableBuffer} implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.4 $ $Date: 2003/11/16 22:15:11 $
|
||||
* @version $Revision: 1.5 $ $Date: 2003/11/18 22:37:17 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -96,7 +96,7 @@ public class TestObservableBuffer extends AbstractTestCollection implements Obse
|
|||
return new ArrayStack();
|
||||
}
|
||||
|
||||
protected Collection makeConfirmedFullCollection() {
|
||||
public Collection makeConfirmedFullCollection() {
|
||||
ArrayStack stack = new ArrayStack();
|
||||
stack.addAll(Arrays.asList(getFullElements()));
|
||||
return stack;
|
||||
|
@ -106,7 +106,7 @@ public class TestObservableBuffer extends AbstractTestCollection implements Obse
|
|||
return ObservableBuffer.decorate(new ArrayStack(), ObservedTestHelper.LISTENER);
|
||||
}
|
||||
|
||||
protected Collection makeFullCollection() {
|
||||
public Collection makeFullCollection() {
|
||||
List stack = new ArrayStack();
|
||||
stack.addAll(Arrays.asList(getFullElements()));
|
||||
return ObservableBuffer.decorate(stack, ObservedTestHelper.LISTENER);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/observed/Attic/TestObservableCollection.java,v 1.3 2003/11/16 22:15:12 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/observed/Attic/TestObservableCollection.java,v 1.4 2003/11/18 22:37:17 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -72,7 +72,7 @@ import org.apache.commons.collections.collection.AbstractTestCollection;
|
|||
* {@link ObservedCollection} implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/16 22:15:12 $
|
||||
* @version $Revision: 1.4 $ $Date: 2003/11/18 22:37:17 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -96,7 +96,7 @@ public class TestObservableCollection extends AbstractTestCollection implements
|
|||
return new ArrayList();
|
||||
}
|
||||
|
||||
protected Collection makeConfirmedFullCollection() {
|
||||
public Collection makeConfirmedFullCollection() {
|
||||
List list = new ArrayList();
|
||||
list.addAll(Arrays.asList(getFullElements()));
|
||||
return list;
|
||||
|
@ -106,7 +106,7 @@ public class TestObservableCollection extends AbstractTestCollection implements
|
|||
return ObservableCollection.decorate(new ArrayList(), ObservedTestHelper.LISTENER);
|
||||
}
|
||||
|
||||
protected Collection makeFullCollection() {
|
||||
public Collection makeFullCollection() {
|
||||
List list = new ArrayList();
|
||||
list.addAll(Arrays.asList(getFullElements()));
|
||||
return ObservableCollection.decorate(list, ObservedTestHelper.LISTENER);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/observed/Attic/TestObservableList.java,v 1.3 2003/11/16 22:15:12 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/observed/Attic/TestObservableList.java,v 1.4 2003/11/18 22:37:17 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -71,7 +71,7 @@ import org.apache.commons.collections.list.AbstractTestList;
|
|||
* {@link ObservedList} implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/16 22:15:12 $
|
||||
* @version $Revision: 1.4 $ $Date: 2003/11/18 22:37:17 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -95,7 +95,7 @@ public class TestObservableList extends AbstractTestList implements ObservedTest
|
|||
return ObservableList.decorate(new ArrayList(), ObservedTestHelper.LISTENER);
|
||||
}
|
||||
|
||||
protected List makeFullList() {
|
||||
public List makeFullList() {
|
||||
List set = new ArrayList();
|
||||
set.addAll(Arrays.asList(getFullElements()));
|
||||
return ObservableList.decorate(set, ObservedTestHelper.LISTENER);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/observed/Attic/TestObservableSet.java,v 1.3 2003/11/16 22:15:12 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/observed/Attic/TestObservableSet.java,v 1.4 2003/11/18 22:37:17 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -71,7 +71,7 @@ import org.apache.commons.collections.set.AbstractTestSet;
|
|||
* {@link ObservedSet} implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/16 22:15:12 $
|
||||
* @version $Revision: 1.4 $ $Date: 2003/11/18 22:37:17 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -91,11 +91,11 @@ public class TestObservableSet extends AbstractTestSet implements ObservedTestHe
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
protected Set makeEmptySet() {
|
||||
public Set makeEmptySet() {
|
||||
return ObservableSet.decorate(new HashSet(), ObservedTestHelper.LISTENER);
|
||||
}
|
||||
|
||||
protected Set makeFullSet() {
|
||||
public Set makeFullSet() {
|
||||
Set set = new HashSet();
|
||||
set.addAll(Arrays.asList(getFullElements()));
|
||||
return ObservableSet.decorate(set, ObservedTestHelper.LISTENER);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/observed/Attic/TestObservableSortedBag.java,v 1.4 2003/11/16 22:15:12 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/observed/Attic/TestObservableSortedBag.java,v 1.5 2003/11/18 22:37:17 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -69,7 +69,7 @@ import org.apache.commons.collections.bag.AbstractTestSortedBag;
|
|||
* {@link ObservedSortedBag} implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.4 $ $Date: 2003/11/16 22:15:12 $
|
||||
* @version $Revision: 1.5 $ $Date: 2003/11/18 22:37:17 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -89,7 +89,7 @@ public class TestObservableSortedBag extends AbstractTestSortedBag implements Ob
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
protected Bag makeBag() {
|
||||
public Bag makeBag() {
|
||||
return ObservableSortedBag.decorate(new TreeBag(), ObservedTestHelper.LISTENER);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/observed/Attic/TestObservableSortedSet.java,v 1.6 2003/11/16 22:15:12 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/observed/Attic/TestObservableSortedSet.java,v 1.7 2003/11/18 22:37:17 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -72,7 +72,7 @@ import org.apache.commons.collections.set.AbstractTestSortedSet;
|
|||
* {@link ObservedSortedSet} implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.6 $ $Date: 2003/11/16 22:15:12 $
|
||||
* @version $Revision: 1.7 $ $Date: 2003/11/18 22:37:17 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -92,11 +92,11 @@ public class TestObservableSortedSet extends AbstractTestSortedSet implements Ob
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
protected Set makeEmptySet() {
|
||||
public Set makeEmptySet() {
|
||||
return ObservableSortedSet.decorate(new TreeSet(), ObservedTestHelper.LISTENER);
|
||||
}
|
||||
|
||||
protected Set makeFullSet() {
|
||||
public Set makeFullSet() {
|
||||
SortedSet set = new TreeSet();
|
||||
set.addAll(Arrays.asList(getFullElements()));
|
||||
return ObservableSortedSet.decorate(set, ObservedTestHelper.LISTENER);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/pairs/Attic/AbstractTestMapEntry.java,v 1.2 2003/11/02 19:44:37 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/pairs/Attic/AbstractTestMapEntry.java,v 1.3 2003/11/18 22:37:18 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -70,7 +70,7 @@ import junit.framework.TestCase;
|
|||
* type being tested.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/02 19:44:37 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:18 $
|
||||
*
|
||||
* @author Neil O'Toole
|
||||
*/
|
||||
|
@ -94,7 +94,7 @@ public abstract class AbstractTestMapEntry extends TestCase {
|
|||
* This implementation simply calls {@link #makeMapEntry(Object, Object)}
|
||||
* with null for key and value. Subclasses can override this method if desired.
|
||||
*/
|
||||
protected Map.Entry makeMapEntry() {
|
||||
public Map.Entry makeMapEntry() {
|
||||
return makeMapEntry(null, null);
|
||||
}
|
||||
|
||||
|
@ -103,19 +103,19 @@ public abstract class AbstractTestMapEntry extends TestCase {
|
|||
* Subclasses should override this method to return a Map.Entry
|
||||
* of the type being tested.
|
||||
*/
|
||||
protected abstract Map.Entry makeMapEntry(Object key, Object value);
|
||||
public abstract Map.Entry makeMapEntry(Object key, Object value);
|
||||
|
||||
/**
|
||||
* Makes a Map.Entry of a type that's known to work correctly.
|
||||
*/
|
||||
protected Map.Entry makeKnownMapEntry() {
|
||||
public Map.Entry makeKnownMapEntry() {
|
||||
return makeKnownMapEntry(null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a Map.Entry of a type that's known to work correctly.
|
||||
*/
|
||||
protected Map.Entry makeKnownMapEntry(Object key, Object value) {
|
||||
public Map.Entry makeKnownMapEntry(Object key, Object value) {
|
||||
Map map = new HashMap(1);
|
||||
map.put(key, value);
|
||||
Map.Entry entry = (Map.Entry) map.entrySet().iterator().next();
|
||||
|
|
|
@ -1,113 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestAbstractByteCollection.java,v 1.2 2003/08/31 17:28:41 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.commons.collections.primitives.adapters.IteratorByteIterator;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:41 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public class TestAbstractByteCollection extends TestCase {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestAbstractByteCollection(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new TestSuite(TestAbstractByteCollection.class);
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public void testAddIsUnsupportedByDefault() {
|
||||
ByteCollection col = new ByteCollectionImpl();
|
||||
try {
|
||||
col.add((byte)1);
|
||||
fail("Expected UnsupportedOperationException");
|
||||
} catch(UnsupportedOperationException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
// inner classes
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
static class ByteCollectionImpl extends AbstractByteCollection {
|
||||
public ByteCollectionImpl() {
|
||||
}
|
||||
|
||||
public ByteIterator iterator() {
|
||||
return new IteratorByteIterator(Collections.EMPTY_LIST.iterator());
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,113 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestAbstractCharCollection.java,v 1.2 2003/08/31 17:28:40 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.commons.collections.primitives.adapters.IteratorCharIterator;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:40 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public class TestAbstractCharCollection extends TestCase {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestAbstractCharCollection(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new TestSuite(TestAbstractCharCollection.class);
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public void testAddIsUnsupportedByDefault() {
|
||||
CharCollection col = new CharCollectionImpl();
|
||||
try {
|
||||
col.add((char)1);
|
||||
fail("Expected UnsupportedOperationException");
|
||||
} catch(UnsupportedOperationException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
// inner classes
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
static class CharCollectionImpl extends AbstractCharCollection {
|
||||
public CharCollectionImpl() {
|
||||
}
|
||||
|
||||
public CharIterator iterator() {
|
||||
return new IteratorCharIterator(Collections.EMPTY_LIST.iterator());
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,113 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestAbstractDoubleCollection.java,v 1.2 2003/08/31 17:28:41 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.commons.collections.primitives.adapters.IteratorDoubleIterator;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:41 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public class TestAbstractDoubleCollection extends TestCase {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestAbstractDoubleCollection(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new TestSuite(TestAbstractDoubleCollection.class);
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public void testAddIsUnsupportedByDefault() {
|
||||
DoubleCollection col = new DoubleCollectionImpl();
|
||||
try {
|
||||
col.add((double)1);
|
||||
fail("Expected UnsupportedOperationException");
|
||||
} catch(UnsupportedOperationException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
// inner classes
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
static class DoubleCollectionImpl extends AbstractDoubleCollection {
|
||||
public DoubleCollectionImpl() {
|
||||
}
|
||||
|
||||
public DoubleIterator iterator() {
|
||||
return new IteratorDoubleIterator(Collections.EMPTY_LIST.iterator());
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,113 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestAbstractFloatCollection.java,v 1.2 2003/08/31 17:28:40 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.commons.collections.primitives.adapters.IteratorFloatIterator;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:40 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public class TestAbstractFloatCollection extends TestCase {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestAbstractFloatCollection(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new TestSuite(TestAbstractFloatCollection.class);
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public void testAddIsUnsupportedByDefault() {
|
||||
FloatCollection col = new FloatCollectionImpl();
|
||||
try {
|
||||
col.add((float)1);
|
||||
fail("Expected UnsupportedOperationException");
|
||||
} catch(UnsupportedOperationException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
// inner classes
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
static class FloatCollectionImpl extends AbstractFloatCollection {
|
||||
public FloatCollectionImpl() {
|
||||
}
|
||||
|
||||
public FloatIterator iterator() {
|
||||
return new IteratorFloatIterator(Collections.EMPTY_LIST.iterator());
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,113 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestAbstractIntCollection.java,v 1.2 2003/08/31 17:28:40 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.commons.collections.primitives.adapters.IteratorIntIterator;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:40 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public class TestAbstractIntCollection extends TestCase {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestAbstractIntCollection(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new TestSuite(TestAbstractIntCollection.class);
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public void testAddIsUnsupportedByDefault() {
|
||||
IntCollection col = new IntCollectionImpl();
|
||||
try {
|
||||
col.add(1);
|
||||
fail("Expected UnsupportedOperationException");
|
||||
} catch(UnsupportedOperationException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
// inner classes
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
static class IntCollectionImpl extends AbstractIntCollection {
|
||||
public IntCollectionImpl() {
|
||||
}
|
||||
|
||||
public IntIterator iterator() {
|
||||
return new IteratorIntIterator(Collections.EMPTY_LIST.iterator());
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,162 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestAbstractLongArrayList.java,v 1.10 2003/11/16 22:15:11 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.collections.list.AbstractTestList;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.10 $ $Date: 2003/11/16 22:15:11 $
|
||||
* @author Rodney Waldhoff
|
||||
* @deprecated this should have been removed along with the others
|
||||
*/
|
||||
public abstract class TestAbstractLongArrayList extends AbstractTestList {
|
||||
|
||||
//------------------------------------------------------------ Conventional
|
||||
|
||||
public TestAbstractLongArrayList(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------- Abstract
|
||||
|
||||
abstract protected AbstractLongList createList();
|
||||
|
||||
//------------------------------------------------------- TestList interface
|
||||
|
||||
public List makeEmptyList() {
|
||||
return createList();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------- Tests
|
||||
|
||||
public void testAddGet() {
|
||||
AbstractLongList list = createList();
|
||||
for(long i=0L;i<1000L;i++) {
|
||||
list.addLong(i);
|
||||
}
|
||||
for(int i=0;i<1000;i++) {
|
||||
assertEquals((long)i,list.getLong(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void testAddGetLargeValues() {
|
||||
AbstractLongList list = createList();
|
||||
for(long i=0L;i<1000L;i++) {
|
||||
long value = ((long)(Integer.MAX_VALUE));
|
||||
value += i;
|
||||
list.addLong(value);
|
||||
}
|
||||
for(long i=0L;i<1000L;i++) {
|
||||
long value = ((long)(Integer.MAX_VALUE));
|
||||
value += i;
|
||||
assertEquals(value,list.getLong((int)i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array of Long objects for testing.
|
||||
*/
|
||||
protected Object[] getFullElements() {
|
||||
Long[] result = new Long[19];
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i] = new Long(i + 19);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array of Long objects for testing.
|
||||
*/
|
||||
protected Object[] getOtherElements() {
|
||||
Long[] result = new Long[16];
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i] = new Long(i + 48);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void testCanonicalEmptyCollectionExists() {
|
||||
}
|
||||
|
||||
|
||||
public void testCanonicalFullCollectionExists() {
|
||||
}
|
||||
|
||||
public void testEmptyListCompatibility() {
|
||||
}
|
||||
|
||||
public void testFullListCompatibility() {
|
||||
}
|
||||
|
||||
public void testCollectionIteratorFailFast() {
|
||||
}
|
||||
|
||||
public void testListSubListFailFastOnAdd() {
|
||||
}
|
||||
|
||||
public void testListSubListFailFastOnRemove() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,113 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestAbstractLongCollection.java,v 1.2 2003/08/31 17:28:40 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.commons.collections.primitives.adapters.IteratorLongIterator;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:40 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public class TestAbstractLongCollection extends TestCase {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestAbstractLongCollection(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new TestSuite(TestAbstractLongCollection.class);
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public void testAddIsUnsupportedByDefault() {
|
||||
LongCollection col = new LongCollectionImpl();
|
||||
try {
|
||||
col.add((long)1);
|
||||
fail("Expected UnsupportedOperationException");
|
||||
} catch(UnsupportedOperationException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
// inner classes
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
static class LongCollectionImpl extends AbstractLongCollection {
|
||||
public LongCollectionImpl() {
|
||||
}
|
||||
|
||||
public LongIterator iterator() {
|
||||
return new IteratorLongIterator(Collections.EMPTY_LIST.iterator());
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,113 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestAbstractShortCollection.java,v 1.2 2003/08/31 17:28:41 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.commons.collections.primitives.adapters.IteratorShortIterator;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:41 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public class TestAbstractShortCollection extends TestCase {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestAbstractShortCollection(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new TestSuite(TestAbstractShortCollection.class);
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public void testAddIsUnsupportedByDefault() {
|
||||
ShortCollection col = new ShortCollectionImpl();
|
||||
try {
|
||||
col.add((short)1);
|
||||
fail("Expected UnsupportedOperationException");
|
||||
} catch(UnsupportedOperationException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
// inner classes
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
static class ShortCollectionImpl extends AbstractShortCollection {
|
||||
public ShortCollectionImpl() {
|
||||
}
|
||||
|
||||
public ShortIterator iterator() {
|
||||
return new IteratorShortIterator(Collections.EMPTY_LIST.iterator());
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,119 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestAll.java,v 1.22 2003/09/27 10:54:06 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.22 $ $Date: 2003/09/27 10:54:06 $
|
||||
* @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(TestAbstractByteCollection.suite());
|
||||
suite.addTest(TestRandomAccessByteList.suite());
|
||||
suite.addTest(TestArrayByteList.suite());
|
||||
|
||||
suite.addTest(TestAbstractShortCollection.suite());
|
||||
suite.addTest(TestRandomAccessShortList.suite());
|
||||
suite.addTest(TestArrayShortList.suite());
|
||||
suite.addTest(TestArrayUnsignedByteList.suite());
|
||||
|
||||
suite.addTest(TestAbstractCharCollection.suite());
|
||||
suite.addTest(TestRandomAccessCharList.suite());
|
||||
suite.addTest(TestArrayCharList.suite());
|
||||
|
||||
suite.addTest(TestIntCollections.suite());
|
||||
suite.addTest(TestAbstractIntCollection.suite());
|
||||
suite.addTest(TestRandomAccessIntList.suite());
|
||||
suite.addTest(TestArrayIntList.suite());
|
||||
suite.addTest(TestArrayUnsignedShortList.suite());
|
||||
|
||||
suite.addTest(TestAbstractLongCollection.suite());
|
||||
suite.addTest(TestRandomAccessLongList.suite());
|
||||
suite.addTest(TestArrayLongList.suite());
|
||||
suite.addTest(TestArrayUnsignedIntList.suite());
|
||||
|
||||
suite.addTest(TestAbstractFloatCollection.suite());
|
||||
suite.addTest(TestRandomAccessFloatList.suite());
|
||||
suite.addTest(TestArrayFloatList.suite());
|
||||
|
||||
suite.addTest(TestAbstractDoubleCollection.suite());
|
||||
suite.addTest(TestRandomAccessDoubleList.suite());
|
||||
suite.addTest(TestArrayDoubleList.suite());
|
||||
|
||||
suite.addTest(org.apache.commons.collections.primitives.adapters.TestAll.suite());
|
||||
suite.addTest(org.apache.commons.collections.primitives.decorators.TestAll.suite());
|
||||
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,222 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestArrayByteList.java,v 1.5 2003/10/05 20:48:59 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.commons.collections.BulkTest;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.5 $ $Date: 2003/10/05 20:48:59 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public class TestArrayByteList extends TestByteList {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestArrayByteList(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = BulkTest.makeSuite(TestArrayByteList.class);
|
||||
return suite;
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
protected ByteList makeEmptyByteList() {
|
||||
return new ArrayByteList();
|
||||
}
|
||||
|
||||
protected String[] ignoredTests() {
|
||||
// sublists are not serializable
|
||||
return new String[] {
|
||||
"TestArrayByteList.bulkTestSubList.testFullListSerialization",
|
||||
"TestArrayByteList.bulkTestSubList.testEmptyListSerialization",
|
||||
"TestArrayByteList.bulkTestSubList.testCanonicalEmptyCollectionExists",
|
||||
"TestArrayByteList.bulkTestSubList.testCanonicalFullCollectionExists",
|
||||
"TestArrayByteList.bulkTestSubList.testEmptyListCompatibility",
|
||||
"TestArrayByteList.bulkTestSubList.testFullListCompatibility",
|
||||
"TestArrayByteList.bulkTestSubList.testSerializeDeserializeThenCompare",
|
||||
"TestArrayByteList.bulkTestSubList.testSimpleSerialization"
|
||||
};
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/** @TODO need to add serialized form to cvs */
|
||||
public void testCanonicalEmptyCollectionExists() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testCanonicalFullCollectionExists() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testEmptyListCompatibility() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testFullListCompatibility() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testAddGetLargeValues() {
|
||||
ByteList list = new ArrayByteList();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
byte value = ((byte) (Byte.MAX_VALUE));
|
||||
value -= i;
|
||||
list.add(value);
|
||||
}
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
byte value = ((byte) (Byte.MAX_VALUE));
|
||||
value -= i;
|
||||
assertEquals(value, list.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void testZeroInitialCapacityIsValid() {
|
||||
assertNotNull(new ArrayByteList(0));
|
||||
}
|
||||
|
||||
public void testNegativeInitialCapacityIsInvalid() {
|
||||
try {
|
||||
new ArrayByteList(-1);
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testCopyConstructor() {
|
||||
ArrayByteList expected = new ArrayByteList();
|
||||
for(int i=0;i<10;i++) {
|
||||
expected.add((byte)i);
|
||||
}
|
||||
ArrayByteList list = new ArrayByteList(expected);
|
||||
assertEquals(10,list.size());
|
||||
assertEquals(expected,list);
|
||||
}
|
||||
|
||||
public void testCopyConstructorWithNull() {
|
||||
try {
|
||||
new ArrayByteList(null);
|
||||
fail("Expected NullPointerException");
|
||||
} catch(NullPointerException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testTrimToSize() {
|
||||
ArrayByteList list = new ArrayByteList();
|
||||
for(int j=0;j<3;j++) {
|
||||
assertTrue(list.isEmpty());
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
assertTrue(list.isEmpty());
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
list.add((byte)i);
|
||||
}
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
assertEquals((byte)i,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
assertEquals((byte)i,list.get(i));
|
||||
}
|
||||
|
||||
for(int i=0;i<10;i+=2) {
|
||||
list.removeElement((byte)i);
|
||||
}
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((byte)(2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((byte)(2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((byte)(2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,222 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestArrayCharList.java,v 1.4 2003/10/05 20:48:59 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.commons.collections.BulkTest;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.4 $ $Date: 2003/10/05 20:48:59 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public class TestArrayCharList extends TestCharList {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestArrayCharList(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = BulkTest.makeSuite(TestArrayCharList.class);
|
||||
return suite;
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
protected CharList makeEmptyCharList() {
|
||||
return new ArrayCharList();
|
||||
}
|
||||
|
||||
protected String[] ignoredTests() {
|
||||
// sublists are not serializable
|
||||
return new String[] {
|
||||
"TestArrayCharList.bulkTestSubList.testFullListSerialization",
|
||||
"TestArrayCharList.bulkTestSubList.testEmptyListSerialization",
|
||||
"TestArrayCharList.bulkTestSubList.testCanonicalEmptyCollectionExists",
|
||||
"TestArrayCharList.bulkTestSubList.testCanonicalFullCollectionExists",
|
||||
"TestArrayCharList.bulkTestSubList.testEmptyListCompatibility",
|
||||
"TestArrayCharList.bulkTestSubList.testFullListCompatibility",
|
||||
"TestArrayCharList.bulkTestSubList.testSerializeDeserializeThenCompare",
|
||||
"TestArrayCharList.bulkTestSubList.testSimpleSerialization"
|
||||
};
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/** @TODO need to add serialized form to cvs */
|
||||
public void testCanonicalEmptyCollectionExists() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testCanonicalFullCollectionExists() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testEmptyListCompatibility() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testFullListCompatibility() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testAddGetLargeValues() {
|
||||
CharList list = new ArrayCharList();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
char value = ((char) (Character.MAX_VALUE));
|
||||
value -= i;
|
||||
list.add(value);
|
||||
}
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
char value = ((char) (Character.MAX_VALUE));
|
||||
value -= i;
|
||||
assertEquals(value, list.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void testZeroInitialCapacityIsValid() {
|
||||
assertNotNull(new ArrayCharList(0));
|
||||
}
|
||||
|
||||
public void testNegativeInitialCapacityIsInvalid() {
|
||||
try {
|
||||
new ArrayCharList(-1);
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testCopyConstructor() {
|
||||
ArrayCharList expected = new ArrayCharList();
|
||||
for(int i=0;i<10;i++) {
|
||||
expected.add((char)i);
|
||||
}
|
||||
ArrayCharList list = new ArrayCharList(expected);
|
||||
assertEquals(10,list.size());
|
||||
assertEquals(expected,list);
|
||||
}
|
||||
|
||||
public void testCopyConstructorWithNull() {
|
||||
try {
|
||||
new ArrayCharList(null);
|
||||
fail("Expected NullPointerException");
|
||||
} catch(NullPointerException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testTrimToSize() {
|
||||
ArrayCharList list = new ArrayCharList();
|
||||
for(int j=0;j<3;j++) {
|
||||
assertTrue(list.isEmpty());
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
assertTrue(list.isEmpty());
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
list.add((char)i);
|
||||
}
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
assertEquals((char)i,list.get(i), 0f);
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
assertEquals((char)i,list.get(i), 0f);
|
||||
}
|
||||
|
||||
for(int i=0;i<10;i+=2) {
|
||||
list.removeElement((char)i);
|
||||
}
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((char)(2*i)+1,list.get(i), 0f);
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((char)(2*i)+1,list.get(i), 0f);
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((char)(2*i)+1,list.get(i), 0f);
|
||||
}
|
||||
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,222 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestArrayDoubleList.java,v 1.4 2003/10/05 20:48:58 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.commons.collections.BulkTest;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.4 $ $Date: 2003/10/05 20:48:58 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public class TestArrayDoubleList extends TestDoubleList {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestArrayDoubleList(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = BulkTest.makeSuite(TestArrayDoubleList.class);
|
||||
return suite;
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
protected DoubleList makeEmptyDoubleList() {
|
||||
return new ArrayDoubleList();
|
||||
}
|
||||
|
||||
protected String[] ignoredTests() {
|
||||
// sublists are not serializable
|
||||
return new String[] {
|
||||
"TestArrayDoubleList.bulkTestSubList.testFullListSerialization",
|
||||
"TestArrayDoubleList.bulkTestSubList.testEmptyListSerialization",
|
||||
"TestArrayDoubleList.bulkTestSubList.testCanonicalEmptyCollectionExists",
|
||||
"TestArrayDoubleList.bulkTestSubList.testCanonicalFullCollectionExists",
|
||||
"TestArrayDoubleList.bulkTestSubList.testEmptyListCompatibility",
|
||||
"TestArrayDoubleList.bulkTestSubList.testFullListCompatibility",
|
||||
"TestArrayDoubleList.bulkTestSubList.testSerializeDeserializeThenCompare",
|
||||
"TestArrayDoubleList.bulkTestSubList.testSimpleSerialization"
|
||||
};
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/** @TODO need to add serialized form to cvs */
|
||||
public void testCanonicalEmptyCollectionExists() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testCanonicalFullCollectionExists() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testEmptyListCompatibility() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testFullListCompatibility() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testAddGetLargeValues() {
|
||||
DoubleList list = new ArrayDoubleList();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
double value = ((double) (Double.MAX_VALUE));
|
||||
value -= i;
|
||||
list.add(value);
|
||||
}
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
double value = ((double) (Double.MAX_VALUE));
|
||||
value -= i;
|
||||
assertEquals(value, list.get(i), 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public void testZeroInitialCapacityIsValid() {
|
||||
assertNotNull(new ArrayDoubleList(0));
|
||||
}
|
||||
|
||||
public void testNegativeInitialCapacityIsInvalid() {
|
||||
try {
|
||||
new ArrayDoubleList(-1);
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testCopyConstructor() {
|
||||
ArrayDoubleList expected = new ArrayDoubleList();
|
||||
for(int i=0;i<10;i++) {
|
||||
expected.add((double)i);
|
||||
}
|
||||
ArrayDoubleList list = new ArrayDoubleList(expected);
|
||||
assertEquals(10,list.size());
|
||||
assertEquals(expected,list);
|
||||
}
|
||||
|
||||
public void testCopyConstructorWithNull() {
|
||||
try {
|
||||
new ArrayDoubleList(null);
|
||||
fail("Expected NullPointerException");
|
||||
} catch(NullPointerException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testTrimToSize() {
|
||||
ArrayDoubleList list = new ArrayDoubleList();
|
||||
for(int j=0;j<3;j++) {
|
||||
assertTrue(list.isEmpty());
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
assertTrue(list.isEmpty());
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
list.add((double)i);
|
||||
}
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
assertEquals((double)i,list.get(i), 0f);
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
assertEquals((double)i,list.get(i), 0f);
|
||||
}
|
||||
|
||||
for(int i=0;i<10;i+=2) {
|
||||
list.removeElement((double)i);
|
||||
}
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((double)(2*i)+1,list.get(i), 0f);
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((double)(2*i)+1,list.get(i), 0f);
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((double)(2*i)+1,list.get(i), 0f);
|
||||
}
|
||||
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,222 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestArrayFloatList.java,v 1.4 2003/10/05 20:48:58 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.commons.collections.BulkTest;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.4 $ $Date: 2003/10/05 20:48:58 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public class TestArrayFloatList extends TestFloatList {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestArrayFloatList(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = BulkTest.makeSuite(TestArrayFloatList.class);
|
||||
return suite;
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
protected FloatList makeEmptyFloatList() {
|
||||
return new ArrayFloatList();
|
||||
}
|
||||
|
||||
protected String[] ignoredTests() {
|
||||
// sublists are not serializable
|
||||
return new String[] {
|
||||
"TestArrayFloatList.bulkTestSubList.testFullListSerialization",
|
||||
"TestArrayFloatList.bulkTestSubList.testEmptyListSerialization",
|
||||
"TestArrayFloatList.bulkTestSubList.testCanonicalEmptyCollectionExists",
|
||||
"TestArrayFloatList.bulkTestSubList.testCanonicalFullCollectionExists",
|
||||
"TestArrayFloatList.bulkTestSubList.testEmptyListCompatibility",
|
||||
"TestArrayFloatList.bulkTestSubList.testFullListCompatibility",
|
||||
"TestArrayFloatList.bulkTestSubList.testSerializeDeserializeThenCompare",
|
||||
"TestArrayFloatList.bulkTestSubList.testSimpleSerialization"
|
||||
};
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/** @TODO need to add serialized form to cvs */
|
||||
public void testCanonicalEmptyCollectionExists() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testCanonicalFullCollectionExists() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testEmptyListCompatibility() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testFullListCompatibility() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testAddGetLargeValues() {
|
||||
FloatList list = new ArrayFloatList();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
float value = ((float) (Float.MAX_VALUE));
|
||||
value -= i;
|
||||
list.add(value);
|
||||
}
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
float value = ((float) (Float.MAX_VALUE));
|
||||
value -= i;
|
||||
assertEquals(value, list.get(i), 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public void testZeroInitialCapacityIsValid() {
|
||||
assertNotNull(new ArrayFloatList(0));
|
||||
}
|
||||
|
||||
public void testNegativeInitialCapacityIsInvalid() {
|
||||
try {
|
||||
new ArrayFloatList(-1);
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testCopyConstructor() {
|
||||
ArrayFloatList expected = new ArrayFloatList();
|
||||
for(int i=0;i<10;i++) {
|
||||
expected.add((float)i);
|
||||
}
|
||||
ArrayFloatList list = new ArrayFloatList(expected);
|
||||
assertEquals(10,list.size());
|
||||
assertEquals(expected,list);
|
||||
}
|
||||
|
||||
public void testCopyConstructorWithNull() {
|
||||
try {
|
||||
new ArrayFloatList(null);
|
||||
fail("Expected NullPointerException");
|
||||
} catch(NullPointerException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testTrimToSize() {
|
||||
ArrayFloatList list = new ArrayFloatList();
|
||||
for(int j=0;j<3;j++) {
|
||||
assertTrue(list.isEmpty());
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
assertTrue(list.isEmpty());
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
list.add((float)i);
|
||||
}
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
assertEquals((float)i,list.get(i), 0f);
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
assertEquals((float)i,list.get(i), 0f);
|
||||
}
|
||||
|
||||
for(int i=0;i<10;i+=2) {
|
||||
list.removeElement((float)i);
|
||||
}
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((float)(2*i)+1,list.get(i), 0f);
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((float)(2*i)+1,list.get(i), 0f);
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((float)(2*i)+1,list.get(i), 0f);
|
||||
}
|
||||
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,222 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestArrayIntList.java,v 1.14 2003/10/05 20:48:58 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.commons.collections.BulkTest;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.14 $ $Date: 2003/10/05 20:48:58 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public class TestArrayIntList extends TestIntList {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestArrayIntList(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = BulkTest.makeSuite(TestArrayIntList.class);
|
||||
return suite;
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
protected IntList makeEmptyIntList() {
|
||||
return new ArrayIntList();
|
||||
}
|
||||
|
||||
protected String[] ignoredTests() {
|
||||
// sublists are not serializable
|
||||
return new String[] {
|
||||
"TestArrayIntList.bulkTestSubList.testFullListSerialization",
|
||||
"TestArrayIntList.bulkTestSubList.testEmptyListSerialization",
|
||||
"TestArrayIntList.bulkTestSubList.testCanonicalEmptyCollectionExists",
|
||||
"TestArrayIntList.bulkTestSubList.testCanonicalFullCollectionExists",
|
||||
"TestArrayIntList.bulkTestSubList.testEmptyListCompatibility",
|
||||
"TestArrayIntList.bulkTestSubList.testFullListCompatibility",
|
||||
"TestArrayIntList.bulkTestSubList.testSerializeDeserializeThenCompare",
|
||||
"TestArrayIntList.bulkTestSubList.testSimpleSerialization"
|
||||
};
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/** @TODO need to add serialized form to cvs */
|
||||
public void testCanonicalEmptyCollectionExists() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testCanonicalFullCollectionExists() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testEmptyListCompatibility() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testFullListCompatibility() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testAddGetLargeValues() {
|
||||
IntList list = new ArrayIntList();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
int value = ((int) (Short.MAX_VALUE));
|
||||
value += i;
|
||||
list.add(value);
|
||||
}
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
int value = ((int) (Short.MAX_VALUE));
|
||||
value += i;
|
||||
assertEquals(value, list.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void testZeroInitialCapacityIsValid() {
|
||||
assertNotNull(new ArrayIntList(0));
|
||||
}
|
||||
|
||||
public void testNegativeInitialCapacityIsInvalid() {
|
||||
try {
|
||||
new ArrayIntList(-1);
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testCopyConstructor() {
|
||||
ArrayIntList expected = new ArrayIntList();
|
||||
for(int i=0;i<10;i++) {
|
||||
expected.add(i);
|
||||
}
|
||||
ArrayIntList list = new ArrayIntList(expected);
|
||||
assertEquals(10,list.size());
|
||||
assertEquals(expected,list);
|
||||
}
|
||||
|
||||
public void testCopyConstructorWithNull() {
|
||||
try {
|
||||
new ArrayIntList(null);
|
||||
fail("Expected NullPointerException");
|
||||
} catch(NullPointerException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testTrimToSize() {
|
||||
ArrayIntList list = new ArrayIntList();
|
||||
for(int j=0;j<3;j++) {
|
||||
assertTrue(list.isEmpty());
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
assertTrue(list.isEmpty());
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
list.add(i);
|
||||
}
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
assertEquals(i,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
assertEquals(i,list.get(i));
|
||||
}
|
||||
|
||||
for(int i=0;i<10;i+=2) {
|
||||
list.removeElement(i);
|
||||
}
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,222 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestArrayLongList.java,v 1.4 2003/10/05 20:48:58 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.commons.collections.BulkTest;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.4 $ $Date: 2003/10/05 20:48:58 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public class TestArrayLongList extends TestLongList {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestArrayLongList(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = BulkTest.makeSuite(TestArrayLongList.class);
|
||||
return suite;
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
protected LongList makeEmptyLongList() {
|
||||
return new ArrayLongList();
|
||||
}
|
||||
|
||||
protected String[] ignoredTests() {
|
||||
// sublists are not serializable
|
||||
return new String[] {
|
||||
"TestArrayLongList.bulkTestSubList.testFullListSerialization",
|
||||
"TestArrayLongList.bulkTestSubList.testEmptyListSerialization",
|
||||
"TestArrayLongList.bulkTestSubList.testCanonicalEmptyCollectionExists",
|
||||
"TestArrayLongList.bulkTestSubList.testCanonicalFullCollectionExists",
|
||||
"TestArrayLongList.bulkTestSubList.testEmptyListCompatibility",
|
||||
"TestArrayLongList.bulkTestSubList.testFullListCompatibility",
|
||||
"TestArrayLongList.bulkTestSubList.testSerializeDeserializeThenCompare",
|
||||
"TestArrayLongList.bulkTestSubList.testSimpleSerialization"
|
||||
};
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/** @TODO need to add serialized form to cvs */
|
||||
public void testCanonicalEmptyCollectionExists() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testCanonicalFullCollectionExists() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testEmptyListCompatibility() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testFullListCompatibility() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testAddGetLargeValues() {
|
||||
LongList list = new ArrayLongList();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
long value = ((long) (Integer.MAX_VALUE));
|
||||
value += i;
|
||||
list.add(value);
|
||||
}
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
long value = ((long) (Integer.MAX_VALUE));
|
||||
value += i;
|
||||
assertEquals(value, list.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void testZeroInitialCapacityIsValid() {
|
||||
assertNotNull(new ArrayLongList(0));
|
||||
}
|
||||
|
||||
public void testNegativeInitialCapacityIsInvalid() {
|
||||
try {
|
||||
new ArrayLongList(-1);
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testCopyConstructor() {
|
||||
ArrayLongList expected = new ArrayLongList();
|
||||
for(int i=0;i<10;i++) {
|
||||
expected.add((long)i);
|
||||
}
|
||||
ArrayLongList list = new ArrayLongList(expected);
|
||||
assertEquals(10,list.size());
|
||||
assertEquals(expected,list);
|
||||
}
|
||||
|
||||
public void testCopyConstructorWithNull() {
|
||||
try {
|
||||
new ArrayLongList(null);
|
||||
fail("Expected NullPointerException");
|
||||
} catch(NullPointerException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testTrimToSize() {
|
||||
ArrayLongList list = new ArrayLongList();
|
||||
for(int j=0;j<3;j++) {
|
||||
assertTrue(list.isEmpty());
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
assertTrue(list.isEmpty());
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
list.add((long)i);
|
||||
}
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
assertEquals((long)i,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
assertEquals((long)i,list.get(i));
|
||||
}
|
||||
|
||||
for(int i=0;i<10;i+=2) {
|
||||
list.removeElement((long)i);
|
||||
}
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((long)(2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((long)(2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((long)(2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,222 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestArrayShortList.java,v 1.4 2003/10/05 20:48:59 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.commons.collections.BulkTest;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.4 $ $Date: 2003/10/05 20:48:59 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public class TestArrayShortList extends TestShortList {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestArrayShortList(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = BulkTest.makeSuite(TestArrayShortList.class);
|
||||
return suite;
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
protected ShortList makeEmptyShortList() {
|
||||
return new ArrayShortList();
|
||||
}
|
||||
|
||||
protected String[] ignoredTests() {
|
||||
// sublists are not serializable
|
||||
return new String[] {
|
||||
"TestArrayShortList.bulkTestSubList.testFullListSerialization",
|
||||
"TestArrayShortList.bulkTestSubList.testEmptyListSerialization",
|
||||
"TestArrayShortList.bulkTestSubList.testCanonicalEmptyCollectionExists",
|
||||
"TestArrayShortList.bulkTestSubList.testCanonicalFullCollectionExists",
|
||||
"TestArrayShortList.bulkTestSubList.testEmptyListCompatibility",
|
||||
"TestArrayShortList.bulkTestSubList.testFullListCompatibility",
|
||||
"TestArrayShortList.bulkTestSubList.testSerializeDeserializeThenCompare",
|
||||
"TestArrayShortList.bulkTestSubList.testSimpleSerialization"
|
||||
};
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/** @TODO need to add serialized form to cvs */
|
||||
public void testCanonicalEmptyCollectionExists() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testCanonicalFullCollectionExists() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testEmptyListCompatibility() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testFullListCompatibility() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testAddGetLargeValues() {
|
||||
ShortList list = new ArrayShortList();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
short value = ((short) (Integer.MAX_VALUE));
|
||||
value += i;
|
||||
list.add(value);
|
||||
}
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
short value = ((short) (Integer.MAX_VALUE));
|
||||
value += i;
|
||||
assertEquals(value, list.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void testZeroInitialCapacityIsValid() {
|
||||
assertNotNull(new ArrayShortList(0));
|
||||
}
|
||||
|
||||
public void testNegativeInitialCapacityIsInvalid() {
|
||||
try {
|
||||
new ArrayShortList(-1);
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testCopyConstructor() {
|
||||
ArrayShortList expected = new ArrayShortList();
|
||||
for(int i=0;i<10;i++) {
|
||||
expected.add((short)i);
|
||||
}
|
||||
ArrayShortList list = new ArrayShortList(expected);
|
||||
assertEquals(10,list.size());
|
||||
assertEquals(expected,list);
|
||||
}
|
||||
|
||||
public void testCopyConstructorWithNull() {
|
||||
try {
|
||||
new ArrayShortList(null);
|
||||
fail("Expected NullPointerException");
|
||||
} catch(NullPointerException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testTrimToSize() {
|
||||
ArrayShortList list = new ArrayShortList();
|
||||
for(int j=0;j<3;j++) {
|
||||
assertTrue(list.isEmpty());
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
assertTrue(list.isEmpty());
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
list.add((short)i);
|
||||
}
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
assertEquals((short)i,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
assertEquals((short)i,list.get(i));
|
||||
}
|
||||
|
||||
for(int i=0;i<10;i+=2) {
|
||||
list.removeElement((short)i);
|
||||
}
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((short)(2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((short)(2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((short)(2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,234 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestArrayUnsignedByteList.java,v 1.4 2003/10/05 20:48:58 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.commons.collections.BulkTest;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.4 $ $Date: 2003/10/05 20:48:58 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public class TestArrayUnsignedByteList extends TestShortList {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestArrayUnsignedByteList(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = BulkTest.makeSuite(TestArrayUnsignedByteList.class);
|
||||
return suite;
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
protected ShortList makeEmptyShortList() {
|
||||
return new ArrayUnsignedByteList();
|
||||
}
|
||||
|
||||
protected String[] ignoredTests() {
|
||||
// sublists are not serializable
|
||||
return new String[] {
|
||||
"TestArrayUnsignedByteList.bulkTestSubList.testFullListSerialization",
|
||||
"TestArrayUnsignedByteList.bulkTestSubList.testEmptyListSerialization",
|
||||
"TestArrayUnsignedByteList.bulkTestSubList.testCanonicalEmptyCollectionExists",
|
||||
"TestArrayUnsignedByteList.bulkTestSubList.testCanonicalFullCollectionExists",
|
||||
"TestArrayUnsignedByteList.bulkTestSubList.testEmptyListCompatibility",
|
||||
"TestArrayUnsignedByteList.bulkTestSubList.testFullListCompatibility",
|
||||
"TestArrayUnsignedByteList.bulkTestSubList.testSerializeDeserializeThenCompare",
|
||||
"TestArrayUnsignedByteList.bulkTestSubList.testSimpleSerialization"
|
||||
};
|
||||
}
|
||||
|
||||
protected short[] getFullShorts() {
|
||||
short[] result = new short[19];
|
||||
for(int i = 0; i < result.length; i++) {
|
||||
result[i] = (short)(ArrayUnsignedByteList.MAX_VALUE - i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// @TODO need to add serialized form to cvs
|
||||
public void testCanonicalEmptyCollectionExists() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testCanonicalFullCollectionExists() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testEmptyListCompatibility() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testFullListCompatibility() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testZeroInitialCapacityIsValid() {
|
||||
assertNotNull(new ArrayUnsignedByteList(0));
|
||||
}
|
||||
|
||||
public void testIllegalArgumentExceptionWhenElementOutOfRange() {
|
||||
ArrayUnsignedByteList list = new ArrayUnsignedByteList();
|
||||
list.add(ArrayUnsignedByteList.MIN_VALUE);
|
||||
list.add(ArrayUnsignedByteList.MAX_VALUE);
|
||||
try {
|
||||
list.add((short)-1);
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
try {
|
||||
list.add((short)(ArrayUnsignedByteList.MAX_VALUE+1));
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testNegativeInitialCapacityIsInvalid() {
|
||||
try {
|
||||
new ArrayUnsignedByteList(-1);
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testCopyConstructor() {
|
||||
ArrayUnsignedByteList expected = new ArrayUnsignedByteList();
|
||||
for(int i=0;i<10;i++) {
|
||||
expected.add((short)i);
|
||||
}
|
||||
ArrayUnsignedByteList list = new ArrayUnsignedByteList(expected);
|
||||
assertEquals(10,list.size());
|
||||
assertEquals(expected,list);
|
||||
}
|
||||
|
||||
public void testCopyConstructorWithNull() {
|
||||
try {
|
||||
new ArrayUnsignedByteList(null);
|
||||
fail("Expected NullPointerException");
|
||||
} catch(NullPointerException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testTrimToSize() {
|
||||
ArrayUnsignedByteList list = new ArrayUnsignedByteList();
|
||||
for(int j=0;j<3;j++) {
|
||||
assertTrue(list.isEmpty());
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
assertTrue(list.isEmpty());
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
list.add((short)i);
|
||||
}
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
assertEquals(i,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
assertEquals(i,list.get(i));
|
||||
}
|
||||
|
||||
for(int i=0;i<10;i+=2) {
|
||||
list.removeElement((short)i);
|
||||
}
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,234 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestArrayUnsignedIntList.java,v 1.4 2003/10/05 20:48:59 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.commons.collections.BulkTest;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.4 $ $Date: 2003/10/05 20:48:59 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public class TestArrayUnsignedIntList extends TestLongList {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestArrayUnsignedIntList(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = BulkTest.makeSuite(TestArrayUnsignedIntList.class);
|
||||
return suite;
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
protected LongList makeEmptyLongList() {
|
||||
return new ArrayUnsignedIntList();
|
||||
}
|
||||
|
||||
protected String[] ignoredTests() {
|
||||
// sublists are not serializable
|
||||
return new String[] {
|
||||
"TestArrayUnsignedLongList.bulkTestSubList.testFullListSerialization",
|
||||
"TestArrayUnsignedLongList.bulkTestSubList.testEmptyListSerialization",
|
||||
"TestArrayUnsignedLongList.bulkTestSubList.testCanonicalEmptyCollectionExists",
|
||||
"TestArrayUnsignedLongList.bulkTestSubList.testCanonicalFullCollectionExists",
|
||||
"TestArrayUnsignedLongList.bulkTestSubList.testEmptyListCompatibility",
|
||||
"TestArrayUnsignedLongList.bulkTestSubList.testFullListCompatibility",
|
||||
"TestArrayUnsignedLongList.bulkTestSubList.testSerializeDeserializeThenCompare",
|
||||
"TestArrayUnsignedLongList.bulkTestSubList.testSimpleSerialization"
|
||||
};
|
||||
}
|
||||
|
||||
protected long[] getFullLongs() {
|
||||
long[] result = new long[19];
|
||||
for(int i = 0; i < result.length; i++) {
|
||||
result[i] = ((long)Integer.MAX_VALUE - 1L - (long)i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// @TODO need to add serialized form to cvs
|
||||
public void testCanonicalEmptyCollectionExists() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testCanonicalFullCollectionExists() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testEmptyListCompatibility() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testFullListCompatibility() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testZeroInitialCapacityIsValid() {
|
||||
assertNotNull(new ArrayUnsignedIntList(0));
|
||||
}
|
||||
|
||||
public void testIllegalArgumentExceptionWhenElementOutOfRange() {
|
||||
ArrayUnsignedIntList list = new ArrayUnsignedIntList();
|
||||
list.add(ArrayUnsignedIntList.MIN_VALUE);
|
||||
list.add(ArrayUnsignedIntList.MAX_VALUE);
|
||||
try {
|
||||
list.add(-1);
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
try {
|
||||
list.add(ArrayUnsignedIntList.MAX_VALUE+1);
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testNegativeInitialCapacityIsInvalid() {
|
||||
try {
|
||||
new ArrayUnsignedIntList(-1);
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testCopyConstructor() {
|
||||
ArrayUnsignedIntList expected = new ArrayUnsignedIntList();
|
||||
for(int i=0;i<10;i++) {
|
||||
expected.add(i);
|
||||
}
|
||||
ArrayUnsignedIntList list = new ArrayUnsignedIntList(expected);
|
||||
assertEquals(10,list.size());
|
||||
assertEquals(expected,list);
|
||||
}
|
||||
|
||||
public void testCopyConstructorWithNull() {
|
||||
try {
|
||||
new ArrayUnsignedIntList(null);
|
||||
fail("Expected NullPointerException");
|
||||
} catch(NullPointerException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testTrimToSize() {
|
||||
ArrayUnsignedIntList list = new ArrayUnsignedIntList();
|
||||
for(int j=0;j<3;j++) {
|
||||
assertTrue(list.isEmpty());
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
assertTrue(list.isEmpty());
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
list.add(i);
|
||||
}
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
assertEquals(i,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
assertEquals(i,list.get(i));
|
||||
}
|
||||
|
||||
for(int i=0;i<10;i+=2) {
|
||||
list.removeElement(i);
|
||||
}
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,226 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestArrayUnsignedShortList.java,v 1.14 2003/10/05 20:48:58 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.commons.collections.BulkTest;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.14 $ $Date: 2003/10/05 20:48:58 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public class TestArrayUnsignedShortList extends TestIntList {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestArrayUnsignedShortList(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = BulkTest.makeSuite(TestArrayUnsignedShortList.class);
|
||||
return suite;
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
protected IntList makeEmptyIntList() {
|
||||
return new ArrayUnsignedShortList();
|
||||
}
|
||||
|
||||
protected String[] ignoredTests() {
|
||||
// sublists are not serializable
|
||||
return new String[] {
|
||||
"TestArrayUnsignedShortList.bulkTestSubList.testFullListSerialization",
|
||||
"TestArrayUnsignedShortList.bulkTestSubList.testEmptyListSerialization",
|
||||
"TestArrayUnsignedShortList.bulkTestSubList.testCanonicalEmptyCollectionExists",
|
||||
"TestArrayUnsignedShortList.bulkTestSubList.testCanonicalFullCollectionExists",
|
||||
"TestArrayUnsignedShortList.bulkTestSubList.testEmptyListCompatibility",
|
||||
"TestArrayUnsignedShortList.bulkTestSubList.testFullListCompatibility",
|
||||
"TestArrayUnsignedShortList.bulkTestSubList.testSerializeDeserializeThenCompare",
|
||||
"TestArrayUnsignedShortList.bulkTestSubList.testSimpleSerialization"
|
||||
};
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// @TODO need to add serialized form to cvs
|
||||
public void testCanonicalEmptyCollectionExists() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testCanonicalFullCollectionExists() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testEmptyListCompatibility() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testFullListCompatibility() {
|
||||
// XXX FIX ME XXX
|
||||
// need to add a serialized form to cvs
|
||||
}
|
||||
|
||||
public void testZeroInitialCapacityIsValid() {
|
||||
assertNotNull(new ArrayUnsignedShortList(0));
|
||||
}
|
||||
|
||||
public void testIllegalArgumentExceptionWhenElementOutOfRange() {
|
||||
ArrayUnsignedShortList list = new ArrayUnsignedShortList();
|
||||
list.add(ArrayUnsignedShortList.MIN_VALUE);
|
||||
list.add(ArrayUnsignedShortList.MAX_VALUE);
|
||||
try {
|
||||
list.add(-1);
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
try {
|
||||
list.add(ArrayUnsignedShortList.MAX_VALUE+1);
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testNegativeInitialCapacityIsInvalid() {
|
||||
try {
|
||||
new ArrayUnsignedShortList(-1);
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testCopyConstructor() {
|
||||
ArrayUnsignedShortList expected = new ArrayUnsignedShortList();
|
||||
for(int i=0;i<10;i++) {
|
||||
expected.add(i);
|
||||
}
|
||||
ArrayUnsignedShortList list = new ArrayUnsignedShortList(expected);
|
||||
assertEquals(10,list.size());
|
||||
assertEquals(expected,list);
|
||||
}
|
||||
|
||||
public void testCopyConstructorWithNull() {
|
||||
try {
|
||||
new ArrayUnsignedShortList(null);
|
||||
fail("Expected NullPointerException");
|
||||
} catch(NullPointerException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testTrimToSize() {
|
||||
ArrayUnsignedShortList list = new ArrayUnsignedShortList();
|
||||
for(int j=0;j<3;j++) {
|
||||
assertTrue(list.isEmpty());
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
assertTrue(list.isEmpty());
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
list.add(i);
|
||||
}
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
assertEquals(i,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<10;i++) {
|
||||
assertEquals(i,list.get(i));
|
||||
}
|
||||
|
||||
for(int i=0;i<10;i+=2) {
|
||||
list.removeElement(i);
|
||||
}
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.trimToSize();
|
||||
|
||||
for(int i=0;i<5;i++) {
|
||||
assertEquals((2*i)+1,list.get(i));
|
||||
}
|
||||
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestByteIterator.java,v 1.3 2003/10/01 21:54:56 scolebourne 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 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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import org.apache.commons.collections.iterators.AbstractTestIterator;
|
||||
import org.apache.commons.collections.primitives.adapters.ByteIteratorIterator;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:56 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public abstract class TestByteIterator extends AbstractTestIterator {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestByteIterator(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public Iterator makeEmptyIterator() {
|
||||
return ByteIteratorIterator.wrap(makeEmptyByteIterator());
|
||||
}
|
||||
|
||||
public Iterator makeFullIterator() {
|
||||
return ByteIteratorIterator.wrap(makeFullByteIterator());
|
||||
}
|
||||
|
||||
|
||||
protected abstract ByteIterator makeEmptyByteIterator();
|
||||
protected abstract ByteIterator makeFullByteIterator();
|
||||
protected abstract byte[] getFullElements();
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public void testNextHasNextRemove() {
|
||||
byte[] elements = getFullElements();
|
||||
ByteIterator iter = makeFullByteIterator();
|
||||
for(int i=0;i<elements.length;i++) {
|
||||
assertTrue(iter.hasNext());
|
||||
assertEquals(elements[i],iter.next(),0f);
|
||||
if(supportsRemove()) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
assertTrue(! iter.hasNext() );
|
||||
}
|
||||
|
||||
public void testEmptyByteIterator() {
|
||||
assertTrue( ! makeEmptyByteIterator().hasNext() );
|
||||
try {
|
||||
makeEmptyByteIterator().next();
|
||||
fail("Expected NoSuchElementException");
|
||||
} catch(NoSuchElementException e) {
|
||||
// expected
|
||||
}
|
||||
if(supportsRemove()) {
|
||||
try {
|
||||
makeEmptyByteIterator().remove();
|
||||
fail("Expected IllegalStateException");
|
||||
} catch(IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void testRemoveBeforeNext() {
|
||||
if(supportsRemove()) {
|
||||
try {
|
||||
makeFullByteIterator().remove();
|
||||
fail("Expected IllegalStateException");
|
||||
} catch(IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void testRemoveAfterRemove() {
|
||||
if(supportsRemove()) {
|
||||
ByteIterator iter = makeFullByteIterator();
|
||||
iter.next();
|
||||
iter.remove();
|
||||
try {
|
||||
iter.remove();
|
||||
fail("Expected IllegalStateException");
|
||||
} catch(IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,425 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestByteList.java,v 1.5 2003/11/16 22:15:11 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.collections.list.AbstractTestList;
|
||||
import org.apache.commons.collections.primitives.adapters.ByteListList;
|
||||
import org.apache.commons.collections.primitives.adapters.ListByteList;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.5 $ $Date: 2003/11/16 22:15:11 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public abstract class TestByteList extends AbstractTestList {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestByteList(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// collections testing framework: byte list
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
protected abstract ByteList makeEmptyByteList();
|
||||
|
||||
protected ByteList makeFullByteList() {
|
||||
ByteList list = makeEmptyByteList();
|
||||
byte[] values = getFullBytes();
|
||||
for(int i=0;i<values.length;i++) {
|
||||
list.add(values[i]);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
protected byte[] getFullBytes() {
|
||||
byte[] result = new byte[19];
|
||||
for(int i = 0; i < result.length; i++) {
|
||||
result[i] = (byte)(i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected byte[] getOtherBytes() {
|
||||
byte[] result = new byte[16];
|
||||
for(int i = 0; i < result.length; i++) {
|
||||
result[i] = (byte)(i + 43);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// collections testing framework: inherited
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
protected List makeEmptyList() {
|
||||
return new ByteListList(makeEmptyByteList());
|
||||
}
|
||||
|
||||
protected Object[] getFullElements() {
|
||||
return wrapArray(getFullBytes());
|
||||
}
|
||||
|
||||
protected Object[] getOtherElements() {
|
||||
return wrapArray(getOtherBytes());
|
||||
}
|
||||
|
||||
// private utils
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
private Byte[] wrapArray(byte[] primitives) {
|
||||
Byte[] result = new Byte[primitives.length];
|
||||
for(int i=0;i<result.length;i++) {
|
||||
result[i] = new Byte(primitives[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public void testToJustBigEnoughByteArray() {
|
||||
ByteList list = makeFullByteList();
|
||||
byte[] dest = new byte[list.size()];
|
||||
assertSame(dest,list.toArray(dest));
|
||||
int i=0;
|
||||
for(ByteIterator iter = list.iterator(); iter.hasNext();i++) {
|
||||
assertEquals(iter.next(),dest[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void testToLargerThanNeededByteArray() {
|
||||
ByteList list = makeFullByteList();
|
||||
byte[] dest = new byte[list.size()*2];
|
||||
for(int i=0;i<dest.length;i++) {
|
||||
dest[i] = Byte.MAX_VALUE;
|
||||
}
|
||||
assertSame(dest,list.toArray(dest));
|
||||
int i=0;
|
||||
for(ByteIterator iter = list.iterator(); iter.hasNext();i++) {
|
||||
assertEquals(iter.next(),dest[i]);
|
||||
}
|
||||
for(;i<dest.length;i++) {
|
||||
assertEquals(Byte.MAX_VALUE,dest[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void testToSmallerThanNeededByteArray() {
|
||||
ByteList list = makeFullByteList();
|
||||
byte[] dest = new byte[list.size()/2];
|
||||
byte[] dest2 = list.toArray(dest);
|
||||
assertTrue(dest != dest2);
|
||||
int i=0;
|
||||
for(ByteIterator iter = list.iterator(); iter.hasNext();i++) {
|
||||
assertEquals(iter.next(),dest2[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void testHashCodeSpecification() {
|
||||
ByteList list = makeFullByteList();
|
||||
int hash = 1;
|
||||
for(ByteIterator iter = list.iterator(); iter.hasNext(); ) {
|
||||
hash = 31*hash + ((int)iter.next());
|
||||
}
|
||||
assertEquals(hash,list.hashCode());
|
||||
}
|
||||
|
||||
public void testEqualsWithTwoByteLists() {
|
||||
ByteList one = makeEmptyByteList();
|
||||
assertEquals("Equals is reflexive on empty list",one,one);
|
||||
ByteList two = makeEmptyByteList();
|
||||
assertEquals("Empty lists are equal",one,two);
|
||||
assertEquals("Equals is symmetric on empty lists",two,one);
|
||||
|
||||
one.add((byte)1);
|
||||
assertEquals("Equals is reflexive on non empty list",one,one);
|
||||
assertTrue(!one.equals(two));
|
||||
assertTrue(!two.equals(one));
|
||||
|
||||
two.add((byte)1);
|
||||
assertEquals("Non empty lists are equal",one,two);
|
||||
assertEquals("Equals is symmetric on non empty list",one,two);
|
||||
|
||||
one.add((byte)1); one.add((byte)2); one.add((byte)3); one.add((byte)5); one.add((byte)8);
|
||||
assertEquals("Equals is reflexive on larger non empty list",one,one);
|
||||
assertTrue(!one.equals(two));
|
||||
assertTrue(!two.equals(one));
|
||||
|
||||
two.add((byte)1); two.add((byte)2); two.add((byte)3); two.add((byte)5); two.add((byte)8);
|
||||
assertEquals("Larger non empty lists are equal",one,two);
|
||||
assertEquals("Equals is symmetric on larger non empty list",two,one);
|
||||
|
||||
one.add((byte)9);
|
||||
two.add((byte)10);
|
||||
assertTrue(!one.equals(two));
|
||||
assertTrue(!two.equals(one));
|
||||
|
||||
}
|
||||
|
||||
public void testByteSubListEquals() {
|
||||
ByteList one = makeEmptyByteList();
|
||||
assertEquals(one,one.subList(0,0));
|
||||
assertEquals(one.subList(0,0),one);
|
||||
|
||||
one.add((byte)1);
|
||||
assertEquals(one,one.subList(0,1));
|
||||
assertEquals(one.subList(0,1),one);
|
||||
|
||||
one.add((byte)1); one.add((byte)2); one.add((byte)3); one.add((byte)5); one.add((byte)8);
|
||||
assertEquals(one.subList(0,4),one.subList(0,4));
|
||||
assertEquals(one.subList(3,5),one.subList(3,5));
|
||||
}
|
||||
|
||||
public void testEqualsWithByteListAndList() {
|
||||
ByteList ilist = makeEmptyByteList();
|
||||
List list = new ArrayList();
|
||||
|
||||
assertTrue("Unwrapped, empty List should not be equal to empty ByteList.",!ilist.equals(list));
|
||||
assertTrue("Unwrapped, empty ByteList should not be equal to empty List.",!list.equals(ilist));
|
||||
|
||||
assertEquals(new ListByteList(list),ilist);
|
||||
assertEquals(ilist,new ListByteList(list));
|
||||
assertEquals(new ByteListList(ilist),list);
|
||||
assertEquals(list,new ByteListList(ilist));
|
||||
|
||||
ilist.add((byte)1);
|
||||
list.add(new Byte((byte)1));
|
||||
|
||||
assertTrue("Unwrapped, non-empty List is not equal to non-empty ByteList.",!ilist.equals(list));
|
||||
assertTrue("Unwrapped, non-empty ByteList is not equal to non-empty List.",!list.equals(ilist));
|
||||
|
||||
assertEquals(new ListByteList(list),ilist);
|
||||
assertEquals(ilist,new ListByteList(list));
|
||||
assertEquals(new ByteListList(ilist),list);
|
||||
assertEquals(list,new ByteListList(ilist));
|
||||
|
||||
ilist.add((byte)1); ilist.add((byte)2); ilist.add((byte)3); ilist.add((byte)5); ilist.add((byte)8);
|
||||
list.add(new Byte((byte)1)); list.add(new Byte((byte)2)); list.add(new Byte((byte)3)); list.add(new Byte((byte)5)); list.add(new Byte((byte)8));
|
||||
|
||||
assertTrue("Unwrapped, non-empty List is not equal to non-empty ByteList.",!ilist.equals(list));
|
||||
assertTrue("Unwrapped, non-empty ByteList is not equal to non-empty List.",!list.equals(ilist));
|
||||
|
||||
assertEquals(new ListByteList(list),ilist);
|
||||
assertEquals(ilist,new ListByteList(list));
|
||||
assertEquals(new ByteListList(ilist),list);
|
||||
assertEquals(list,new ByteListList(ilist));
|
||||
|
||||
}
|
||||
|
||||
public void testClearAndSize() {
|
||||
ByteList list = makeEmptyByteList();
|
||||
assertEquals(0, list.size());
|
||||
for(int i = 0; i < 100; i++) {
|
||||
list.add((byte)i);
|
||||
}
|
||||
assertEquals(100, list.size());
|
||||
list.clear();
|
||||
assertEquals(0, list.size());
|
||||
}
|
||||
|
||||
public void testRemoveViaSubList() {
|
||||
ByteList list = makeEmptyByteList();
|
||||
for(int i = 0; i < 100; i++) {
|
||||
list.add((byte)i);
|
||||
}
|
||||
ByteList sub = list.subList(25,75);
|
||||
assertEquals(50,sub.size());
|
||||
for(int i = 0; i < 50; i++) {
|
||||
assertEquals(100-i,list.size());
|
||||
assertEquals(50-i,sub.size());
|
||||
assertEquals((byte)(25+i),sub.removeElementAt(0));
|
||||
assertEquals(50-i-1,sub.size());
|
||||
assertEquals(100-i-1,list.size());
|
||||
}
|
||||
assertEquals(0,sub.size());
|
||||
assertEquals(50,list.size());
|
||||
}
|
||||
|
||||
public void testAddGet() {
|
||||
ByteList list = makeEmptyByteList();
|
||||
for (int i = 0; i < 255; i++) {
|
||||
list.add((byte)i);
|
||||
}
|
||||
for (int i = 0; i < 255; i++) {
|
||||
assertEquals((byte)i, list.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void testAddAndShift() {
|
||||
ByteList list = makeEmptyByteList();
|
||||
list.add(0, (byte)1);
|
||||
assertEquals("Should have one entry", 1, list.size());
|
||||
list.add((byte)3);
|
||||
list.add((byte)4);
|
||||
list.add(1, (byte)2);
|
||||
for(int i = 0; i < 4; i++) {
|
||||
assertEquals("Should get entry back", (byte)(i + 1), list.get(i));
|
||||
}
|
||||
list.add(0, (byte)0);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertEquals("Should get entry back", (byte)i, list.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void testIsSerializable() throws Exception {
|
||||
ByteList list = makeFullByteList();
|
||||
assertTrue(list instanceof Serializable);
|
||||
byte[] ser = writeExternalFormToBytes((Serializable)list);
|
||||
ByteList deser = (ByteList)(readExternalFormFromBytes(ser));
|
||||
assertEquals(list,deser);
|
||||
assertEquals(deser,list);
|
||||
}
|
||||
|
||||
public void testByteListSerializeDeserializeThenCompare() throws Exception {
|
||||
ByteList list = makeFullByteList();
|
||||
if(list instanceof Serializable) {
|
||||
byte[] ser = writeExternalFormToBytes((Serializable)list);
|
||||
ByteList deser = (ByteList)(readExternalFormFromBytes(ser));
|
||||
assertEquals("obj != deserialize(serialize(obj))",list,deser);
|
||||
}
|
||||
}
|
||||
|
||||
public void testSubListsAreNotSerializable() throws Exception {
|
||||
ByteList list = makeFullByteList().subList(2,3);
|
||||
assertTrue( ! (list instanceof Serializable) );
|
||||
}
|
||||
|
||||
public void testSubListOutOfBounds() throws Exception {
|
||||
try {
|
||||
makeEmptyByteList().subList(2,3);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
try {
|
||||
makeFullByteList().subList(-1,3);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
makeFullByteList().subList(5,2);
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
try {
|
||||
makeFullByteList().subList(2,makeFullByteList().size()+2);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testListIteratorOutOfBounds() throws Exception {
|
||||
try {
|
||||
makeEmptyByteList().listIterator(2);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
try {
|
||||
makeFullByteList().listIterator(-1);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
try {
|
||||
makeFullByteList().listIterator(makeFullByteList().size()+2);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testListIteratorSetWithoutNext() throws Exception {
|
||||
ByteListIterator iter = makeFullByteList().listIterator();
|
||||
try {
|
||||
iter.set((byte)3);
|
||||
fail("Expected IllegalStateException");
|
||||
} catch(IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testListIteratorSetAfterRemove() throws Exception {
|
||||
ByteListIterator iter = makeFullByteList().listIterator();
|
||||
iter.next();
|
||||
iter.remove();
|
||||
try {
|
||||
iter.set((byte)3);
|
||||
fail("Expected IllegalStateException");
|
||||
} catch(IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestByteListIterator.java,v 1.2 2003/08/31 17:28:40 scolebourne 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 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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:40 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public abstract class TestByteListIterator extends TestByteIterator {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestByteListIterator(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public ByteIterator makeEmptyByteIterator() {
|
||||
return makeEmptyByteListIterator();
|
||||
}
|
||||
|
||||
public ByteIterator makeFullByteIterator() {
|
||||
return makeFullByteListIterator();
|
||||
}
|
||||
|
||||
public abstract ByteListIterator makeEmptyByteListIterator();
|
||||
public abstract ByteListIterator makeFullByteListIterator();
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestCharIterator.java,v 1.3 2003/10/01 21:54:56 scolebourne 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 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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import org.apache.commons.collections.iterators.AbstractTestIterator;
|
||||
import org.apache.commons.collections.primitives.adapters.CharIteratorIterator;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:56 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public abstract class TestCharIterator extends AbstractTestIterator {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestCharIterator(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public Iterator makeEmptyIterator() {
|
||||
return CharIteratorIterator.wrap(makeEmptyCharIterator());
|
||||
}
|
||||
|
||||
public Iterator makeFullIterator() {
|
||||
return CharIteratorIterator.wrap(makeFullCharIterator());
|
||||
}
|
||||
|
||||
|
||||
protected abstract CharIterator makeEmptyCharIterator();
|
||||
protected abstract CharIterator makeFullCharIterator();
|
||||
protected abstract char[] getFullElements();
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public void testNextHasNextRemove() {
|
||||
char[] elements = getFullElements();
|
||||
CharIterator iter = makeFullCharIterator();
|
||||
for(int i=0;i<elements.length;i++) {
|
||||
assertTrue(iter.hasNext());
|
||||
assertEquals(elements[i],iter.next(),0f);
|
||||
if(supportsRemove()) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
assertTrue(! iter.hasNext() );
|
||||
}
|
||||
|
||||
public void testEmptyCharIterator() {
|
||||
assertTrue( ! makeEmptyCharIterator().hasNext() );
|
||||
try {
|
||||
makeEmptyCharIterator().next();
|
||||
fail("Expected NoSuchElementException");
|
||||
} catch(NoSuchElementException e) {
|
||||
// expected
|
||||
}
|
||||
if(supportsRemove()) {
|
||||
try {
|
||||
makeEmptyCharIterator().remove();
|
||||
fail("Expected IllegalStateException");
|
||||
} catch(IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void testRemoveBeforeNext() {
|
||||
if(supportsRemove()) {
|
||||
try {
|
||||
makeFullCharIterator().remove();
|
||||
fail("Expected IllegalStateException");
|
||||
} catch(IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void testRemoveAfterRemove() {
|
||||
if(supportsRemove()) {
|
||||
CharIterator iter = makeFullCharIterator();
|
||||
iter.next();
|
||||
iter.remove();
|
||||
try {
|
||||
iter.remove();
|
||||
fail("Expected IllegalStateException");
|
||||
} catch(IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,433 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestCharList.java,v 1.5 2003/11/16 22:15:11 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.collections.list.AbstractTestList;
|
||||
import org.apache.commons.collections.primitives.adapters.CharListList;
|
||||
import org.apache.commons.collections.primitives.adapters.ListCharList;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.5 $ $Date: 2003/11/16 22:15:11 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public abstract class TestCharList extends AbstractTestList {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestCharList(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// collections testing framework: char list
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
protected abstract CharList makeEmptyCharList();
|
||||
|
||||
protected CharList makeFullCharList() {
|
||||
CharList list = makeEmptyCharList();
|
||||
char[] values = getFullChars();
|
||||
for(int i=0;i<values.length;i++) {
|
||||
list.add(values[i]);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
protected char[] getFullChars() {
|
||||
char[] result = new char[19];
|
||||
for(int i = 0; i < result.length; i++) {
|
||||
result[i] = (char)(i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected char[] getOtherChars() {
|
||||
char[] result = new char[16];
|
||||
for(int i = 0; i < result.length; i++) {
|
||||
result[i] = (char)(i + 43);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// collections testing framework: inherited
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
protected List makeEmptyList() {
|
||||
return new CharListList(makeEmptyCharList());
|
||||
}
|
||||
|
||||
protected Object[] getFullElements() {
|
||||
return wrapArray(getFullChars());
|
||||
}
|
||||
|
||||
protected Object[] getOtherElements() {
|
||||
return wrapArray(getOtherChars());
|
||||
}
|
||||
|
||||
// private utils
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
private Character[] wrapArray(char[] primitives) {
|
||||
Character[] result = new Character[primitives.length];
|
||||
for(int i=0;i<result.length;i++) {
|
||||
result[i] = new Character(primitives[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public void testToJustBigEnoughCharArray() {
|
||||
CharList list = makeFullCharList();
|
||||
char[] dest = new char[list.size()];
|
||||
assertSame(dest,list.toArray(dest));
|
||||
int i=0;
|
||||
for(CharIterator iter = list.iterator(); iter.hasNext();i++) {
|
||||
assertEquals(iter.next(),dest[i], 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public void testToLargerThanNeededCharArray() {
|
||||
CharList list = makeFullCharList();
|
||||
char[] dest = new char[list.size()*2];
|
||||
for(int i=0;i<dest.length;i++) {
|
||||
dest[i] = Character.MAX_VALUE;
|
||||
}
|
||||
assertSame(dest,list.toArray(dest));
|
||||
int i=0;
|
||||
for(CharIterator iter = list.iterator(); iter.hasNext();i++) {
|
||||
assertEquals(iter.next(),dest[i]);
|
||||
}
|
||||
for(;i<dest.length;i++) {
|
||||
assertEquals(Character.MAX_VALUE,dest[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void testToSmallerThanNeededCharArray() {
|
||||
CharList list = makeFullCharList();
|
||||
char[] dest = new char[list.size()/2];
|
||||
char[] dest2 = list.toArray(dest);
|
||||
assertTrue(dest != dest2);
|
||||
int i=0;
|
||||
for(CharIterator iter = list.iterator(); iter.hasNext();i++) {
|
||||
assertEquals(iter.next(),dest2[i], 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public void testHashCodeSpecification() {
|
||||
CharList list = makeFullCharList();
|
||||
int hash = 1;
|
||||
for(CharIterator iter = list.iterator(); iter.hasNext(); ) {
|
||||
hash = 31*hash + ((int)iter.next());
|
||||
}
|
||||
assertEquals(hash,list.hashCode());
|
||||
}
|
||||
|
||||
public void testEqualsWithTwoCharLists() {
|
||||
CharList one = makeEmptyCharList();
|
||||
assertEquals("Equals is reflexive on empty list",one,one);
|
||||
CharList two = makeEmptyCharList();
|
||||
assertEquals("Empty lists are equal",one,two);
|
||||
assertEquals("Equals is symmetric on empty lists",two,one);
|
||||
|
||||
one.add((char)1);
|
||||
assertEquals("Equals is reflexive on non empty list",one,one);
|
||||
assertTrue(!one.equals(two));
|
||||
assertTrue(!two.equals(one));
|
||||
|
||||
two.add((char)1);
|
||||
assertEquals("Non empty lists are equal",one,two);
|
||||
assertEquals("Equals is symmetric on non empty list",one,two);
|
||||
|
||||
one.add((char)1); one.add((char)2); one.add((char)3); one.add((char)5); one.add((char)8);
|
||||
assertEquals("Equals is reflexive on larger non empty list",one,one);
|
||||
assertTrue(!one.equals(two));
|
||||
assertTrue(!two.equals(one));
|
||||
|
||||
two.add((char)1); two.add((char)2); two.add((char)3); two.add((char)5); two.add((char)8);
|
||||
assertEquals("Larger non empty lists are equal",one,two);
|
||||
assertEquals("Equals is symmetric on larger non empty list",two,one);
|
||||
|
||||
one.add((char)9);
|
||||
two.add((char)10);
|
||||
assertTrue(!one.equals(two));
|
||||
assertTrue(!two.equals(one));
|
||||
|
||||
}
|
||||
|
||||
public void testCharSubListEquals() {
|
||||
CharList one = makeEmptyCharList();
|
||||
assertEquals(one,one.subList(0,0));
|
||||
assertEquals(one.subList(0,0),one);
|
||||
|
||||
one.add((char)1);
|
||||
assertEquals(one,one.subList(0,1));
|
||||
assertEquals(one.subList(0,1),one);
|
||||
|
||||
one.add((char)1); one.add((char)2); one.add((char)3); one.add((char)5); one.add((char)8);
|
||||
assertEquals(one.subList(0,4),one.subList(0,4));
|
||||
assertEquals(one.subList(3,5),one.subList(3,5));
|
||||
}
|
||||
|
||||
public void testEqualsWithCharListAndList() {
|
||||
CharList ilist = makeEmptyCharList();
|
||||
List list = new ArrayList();
|
||||
|
||||
assertTrue("Unwrapped, empty List should not be equal to empty CharList.",!ilist.equals(list));
|
||||
assertTrue("Unwrapped, empty CharList should not be equal to empty List.",!list.equals(ilist));
|
||||
|
||||
assertEquals(new ListCharList(list),ilist);
|
||||
assertEquals(ilist,new ListCharList(list));
|
||||
assertEquals(new CharListList(ilist),list);
|
||||
assertEquals(list,new CharListList(ilist));
|
||||
|
||||
ilist.add((char)1);
|
||||
list.add(new Character((char)1));
|
||||
|
||||
assertTrue("Unwrapped, non-empty List is not equal to non-empty CharList.",!ilist.equals(list));
|
||||
assertTrue("Unwrapped, non-empty CharList is not equal to non-empty List.",!list.equals(ilist));
|
||||
|
||||
assertEquals(new ListCharList(list),ilist);
|
||||
assertEquals(ilist,new ListCharList(list));
|
||||
assertEquals(new CharListList(ilist),list);
|
||||
assertEquals(list,new CharListList(ilist));
|
||||
|
||||
ilist.add((char)1); ilist.add((char)2); ilist.add((char)3); ilist.add((char)5); ilist.add((char)8);
|
||||
list.add(new Character((char)1)); list.add(new Character((char)2)); list.add(new Character((char)3)); list.add(new Character((char)5)); list.add(new Character((char)8));
|
||||
|
||||
assertTrue("Unwrapped, non-empty List is not equal to non-empty CharList.",!ilist.equals(list));
|
||||
assertTrue("Unwrapped, non-empty CharList is not equal to non-empty List.",!list.equals(ilist));
|
||||
|
||||
assertEquals(new ListCharList(list),ilist);
|
||||
assertEquals(ilist,new ListCharList(list));
|
||||
assertEquals(new CharListList(ilist),list);
|
||||
assertEquals(list,new CharListList(ilist));
|
||||
|
||||
}
|
||||
|
||||
public void testClearAndSize() {
|
||||
CharList list = makeEmptyCharList();
|
||||
assertEquals(0, list.size());
|
||||
for(int i = 0; i < 100; i++) {
|
||||
list.add((char)i);
|
||||
}
|
||||
assertEquals(100, list.size());
|
||||
list.clear();
|
||||
assertEquals(0, list.size());
|
||||
}
|
||||
|
||||
public void testRemoveViaSubList() {
|
||||
CharList list = makeEmptyCharList();
|
||||
for(int i = 0; i < 100; i++) {
|
||||
list.add((char)i);
|
||||
}
|
||||
CharList sub = list.subList(25,75);
|
||||
assertEquals(50,sub.size());
|
||||
for(int i = 0; i < 50; i++) {
|
||||
assertEquals(100-i,list.size());
|
||||
assertEquals(50-i,sub.size());
|
||||
assertEquals((char)(25+i),sub.removeElementAt(0), 0f);
|
||||
assertEquals(50-i-1,sub.size());
|
||||
assertEquals(100-i-1,list.size());
|
||||
}
|
||||
assertEquals(0,sub.size());
|
||||
assertEquals(50,list.size());
|
||||
}
|
||||
|
||||
public void testAddGet() {
|
||||
CharList list = makeEmptyCharList();
|
||||
for (int i = 0; i < 255; i++) {
|
||||
list.add((char)i);
|
||||
}
|
||||
for (int i = 0; i < 255; i++) {
|
||||
assertEquals((char)i, list.get(i), 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public void testAddAndShift() {
|
||||
CharList list = makeEmptyCharList();
|
||||
list.add(0, (char)1);
|
||||
assertEquals("Should have one entry", 1, list.size());
|
||||
list.add((char)3);
|
||||
list.add((char)4);
|
||||
list.add(1, (char)2);
|
||||
for(int i = 0; i < 4; i++) {
|
||||
assertEquals("Should get entry back", (char)(i + 1), list.get(i), 0f);
|
||||
}
|
||||
list.add(0, (char)0);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertEquals("Should get entry back", (char)i, list.get(i), 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public void testIsSerializable() throws Exception {
|
||||
CharList list = makeFullCharList();
|
||||
assertTrue(list instanceof Serializable);
|
||||
byte[] ser = writeExternalFormToBytes((Serializable)list);
|
||||
CharList deser = (CharList)(readExternalFormFromBytes(ser));
|
||||
assertEquals(list,deser);
|
||||
assertEquals(deser,list);
|
||||
}
|
||||
|
||||
public void testCharListSerializeDeserializeThenCompare() throws Exception {
|
||||
CharList list = makeFullCharList();
|
||||
if(list instanceof Serializable) {
|
||||
byte[] ser = writeExternalFormToBytes((Serializable)list);
|
||||
CharList deser = (CharList)(readExternalFormFromBytes(ser));
|
||||
assertEquals("obj != deserialize(serialize(obj))",list,deser);
|
||||
}
|
||||
}
|
||||
|
||||
public void testSubListsAreNotSerializable() throws Exception {
|
||||
CharList list = makeFullCharList().subList(2,3);
|
||||
assertTrue( ! (list instanceof Serializable) );
|
||||
}
|
||||
|
||||
public void testSubListOutOfBounds() throws Exception {
|
||||
try {
|
||||
makeEmptyCharList().subList(2,3);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
try {
|
||||
makeFullCharList().subList(-1,3);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
makeFullCharList().subList(5,2);
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
try {
|
||||
makeFullCharList().subList(2,makeFullCharList().size()+2);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testListIteratorOutOfBounds() throws Exception {
|
||||
try {
|
||||
makeEmptyCharList().listIterator(2);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
try {
|
||||
makeFullCharList().listIterator(-1);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
try {
|
||||
makeFullCharList().listIterator(makeFullCharList().size()+2);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testListIteratorSetWithoutNext() throws Exception {
|
||||
CharListIterator iter = makeFullCharList().listIterator();
|
||||
try {
|
||||
iter.set((char)3);
|
||||
fail("Expected IllegalStateException");
|
||||
} catch(IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testListIteratorSetAfterRemove() throws Exception {
|
||||
CharListIterator iter = makeFullCharList().listIterator();
|
||||
iter.next();
|
||||
iter.remove();
|
||||
try {
|
||||
iter.set((char)3);
|
||||
fail("Expected IllegalStateException");
|
||||
} catch(IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testCharListToString() throws Exception {
|
||||
String expected = "The quick brown fox jumped over the lazy dogs.";
|
||||
CharList list = makeEmptyCharList();
|
||||
for(int i=0;i<expected.length();i++) {
|
||||
list.add(expected.charAt(i));
|
||||
}
|
||||
assertEquals(expected,list.toString());
|
||||
}
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestCharListIterator.java,v 1.2 2003/08/31 17:28:41 scolebourne 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 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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:41 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public abstract class TestCharListIterator extends TestCharIterator {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestCharListIterator(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public CharIterator makeEmptyCharIterator() {
|
||||
return makeEmptyCharListIterator();
|
||||
}
|
||||
|
||||
public CharIterator makeFullCharIterator() {
|
||||
return makeFullCharListIterator();
|
||||
}
|
||||
|
||||
public abstract CharListIterator makeEmptyCharListIterator();
|
||||
public abstract CharListIterator makeFullCharListIterator();
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestDoubleIterator.java,v 1.3 2003/10/01 21:54:56 scolebourne 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 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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import org.apache.commons.collections.iterators.AbstractTestIterator;
|
||||
import org.apache.commons.collections.primitives.adapters.DoubleIteratorIterator;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:56 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public abstract class TestDoubleIterator extends AbstractTestIterator {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestDoubleIterator(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public Iterator makeEmptyIterator() {
|
||||
return DoubleIteratorIterator.wrap(makeEmptyDoubleIterator());
|
||||
}
|
||||
|
||||
public Iterator makeFullIterator() {
|
||||
return DoubleIteratorIterator.wrap(makeFullDoubleIterator());
|
||||
}
|
||||
|
||||
|
||||
protected abstract DoubleIterator makeEmptyDoubleIterator();
|
||||
protected abstract DoubleIterator makeFullDoubleIterator();
|
||||
protected abstract double[] getFullElements();
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public void testNextHasNextRemove() {
|
||||
double[] elements = getFullElements();
|
||||
DoubleIterator iter = makeFullDoubleIterator();
|
||||
for(int i=0;i<elements.length;i++) {
|
||||
assertTrue(iter.hasNext());
|
||||
assertEquals(elements[i],iter.next(),0f);
|
||||
if(supportsRemove()) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
assertTrue(! iter.hasNext() );
|
||||
}
|
||||
|
||||
public void testEmptyDoubleIterator() {
|
||||
assertTrue( ! makeEmptyDoubleIterator().hasNext() );
|
||||
try {
|
||||
makeEmptyDoubleIterator().next();
|
||||
fail("Expected NoSuchElementException");
|
||||
} catch(NoSuchElementException e) {
|
||||
// expected
|
||||
}
|
||||
if(supportsRemove()) {
|
||||
try {
|
||||
makeEmptyDoubleIterator().remove();
|
||||
fail("Expected IllegalStateException");
|
||||
} catch(IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void testRemoveBeforeNext() {
|
||||
if(supportsRemove()) {
|
||||
try {
|
||||
makeFullDoubleIterator().remove();
|
||||
fail("Expected IllegalStateException");
|
||||
} catch(IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void testRemoveAfterRemove() {
|
||||
if(supportsRemove()) {
|
||||
DoubleIterator iter = makeFullDoubleIterator();
|
||||
iter.next();
|
||||
iter.remove();
|
||||
try {
|
||||
iter.remove();
|
||||
fail("Expected IllegalStateException");
|
||||
} catch(IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,426 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestDoubleList.java,v 1.4 2003/11/16 22:15:11 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.collections.list.AbstractTestList;
|
||||
import org.apache.commons.collections.primitives.adapters.DoubleListList;
|
||||
import org.apache.commons.collections.primitives.adapters.ListDoubleList;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.4 $ $Date: 2003/11/16 22:15:11 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public abstract class TestDoubleList extends AbstractTestList {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestDoubleList(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// collections testing framework: double list
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
protected abstract DoubleList makeEmptyDoubleList();
|
||||
|
||||
protected DoubleList makeFullDoubleList() {
|
||||
DoubleList list = makeEmptyDoubleList();
|
||||
double[] values = getFullDoubles();
|
||||
for(int i=0;i<values.length;i++) {
|
||||
list.add(values[i]);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
protected double[] getFullDoubles() {
|
||||
double[] result = new double[19];
|
||||
for(int i = 0; i < result.length; i++) {
|
||||
result[i] = (double)(i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected double[] getOtherDoubles() {
|
||||
double[] result = new double[16];
|
||||
for(int i = 0; i < result.length; i++) {
|
||||
result[i] = (double)(i + 43);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// collections testing framework: inherited
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
protected List makeEmptyList() {
|
||||
return new DoubleListList(makeEmptyDoubleList());
|
||||
}
|
||||
|
||||
protected Object[] getFullElements() {
|
||||
return wrapArray(getFullDoubles());
|
||||
}
|
||||
|
||||
protected Object[] getOtherElements() {
|
||||
return wrapArray(getOtherDoubles());
|
||||
}
|
||||
|
||||
// private utils
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
private Double[] wrapArray(double[] primitives) {
|
||||
Double[] result = new Double[primitives.length];
|
||||
for(int i=0;i<result.length;i++) {
|
||||
result[i] = new Double(primitives[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public void testToJustBigEnoughDoubleArray() {
|
||||
DoubleList list = makeFullDoubleList();
|
||||
double[] dest = new double[list.size()];
|
||||
assertSame(dest,list.toArray(dest));
|
||||
int i=0;
|
||||
for(DoubleIterator iter = list.iterator(); iter.hasNext();i++) {
|
||||
assertEquals(iter.next(),dest[i], 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public void testToLargerThanNeededDoubleArray() {
|
||||
DoubleList list = makeFullDoubleList();
|
||||
double[] dest = new double[list.size()*2];
|
||||
for(int i=0;i<dest.length;i++) {
|
||||
dest[i] = Double.MAX_VALUE;
|
||||
}
|
||||
assertSame(dest,list.toArray(dest));
|
||||
int i=0;
|
||||
for(DoubleIterator iter = list.iterator(); iter.hasNext();i++) {
|
||||
assertEquals(iter.next(),dest[i], 0f);
|
||||
}
|
||||
for(;i<dest.length;i++) {
|
||||
assertEquals(Double.MAX_VALUE,dest[i], 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public void testToSmallerThanNeededDoubleArray() {
|
||||
DoubleList list = makeFullDoubleList();
|
||||
double[] dest = new double[list.size()/2];
|
||||
double[] dest2 = list.toArray(dest);
|
||||
assertTrue(dest != dest2);
|
||||
int i=0;
|
||||
for(DoubleIterator iter = list.iterator(); iter.hasNext();i++) {
|
||||
assertEquals(iter.next(),dest2[i], 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public void testHashCodeSpecification() {
|
||||
DoubleList list = makeFullDoubleList();
|
||||
int hash = 1;
|
||||
for(DoubleIterator iter = list.iterator(); iter.hasNext(); ) {
|
||||
long bits = Double.doubleToLongBits(iter.next());
|
||||
hash = 31*hash + ((int)(bits ^ (bits >>> 32)));
|
||||
}
|
||||
assertEquals(hash,list.hashCode());
|
||||
}
|
||||
|
||||
public void testEqualsWithTwoDoubleLists() {
|
||||
DoubleList one = makeEmptyDoubleList();
|
||||
assertEquals("Equals is reflexive on empty list",one,one);
|
||||
DoubleList two = makeEmptyDoubleList();
|
||||
assertEquals("Empty lists are equal",one,two);
|
||||
assertEquals("Equals is symmetric on empty lists",two,one);
|
||||
|
||||
one.add((double)1);
|
||||
assertEquals("Equals is reflexive on non empty list",one,one);
|
||||
assertTrue(!one.equals(two));
|
||||
assertTrue(!two.equals(one));
|
||||
|
||||
two.add((double)1);
|
||||
assertEquals("Non empty lists are equal",one,two);
|
||||
assertEquals("Equals is symmetric on non empty list",one,two);
|
||||
|
||||
one.add((double)1); one.add((double)2); one.add((double)3); one.add((double)5); one.add((double)8);
|
||||
assertEquals("Equals is reflexive on larger non empty list",one,one);
|
||||
assertTrue(!one.equals(two));
|
||||
assertTrue(!two.equals(one));
|
||||
|
||||
two.add((double)1); two.add((double)2); two.add((double)3); two.add((double)5); two.add((double)8);
|
||||
assertEquals("Larger non empty lists are equal",one,two);
|
||||
assertEquals("Equals is symmetric on larger non empty list",two,one);
|
||||
|
||||
one.add((double)9);
|
||||
two.add((double)10);
|
||||
assertTrue(!one.equals(two));
|
||||
assertTrue(!two.equals(one));
|
||||
|
||||
}
|
||||
|
||||
public void testDoubleSubListEquals() {
|
||||
DoubleList one = makeEmptyDoubleList();
|
||||
assertEquals(one,one.subList(0,0));
|
||||
assertEquals(one.subList(0,0),one);
|
||||
|
||||
one.add((double)1);
|
||||
assertEquals(one,one.subList(0,1));
|
||||
assertEquals(one.subList(0,1),one);
|
||||
|
||||
one.add((double)1); one.add((double)2); one.add((double)3); one.add((double)5); one.add((double)8);
|
||||
assertEquals(one.subList(0,4),one.subList(0,4));
|
||||
assertEquals(one.subList(3,5),one.subList(3,5));
|
||||
}
|
||||
|
||||
public void testEqualsWithDoubleListAndList() {
|
||||
DoubleList ilist = makeEmptyDoubleList();
|
||||
List list = new ArrayList();
|
||||
|
||||
assertTrue("Unwrapped, empty List should not be equal to empty DoubleList.",!ilist.equals(list));
|
||||
assertTrue("Unwrapped, empty DoubleList should not be equal to empty List.",!list.equals(ilist));
|
||||
|
||||
assertEquals(new ListDoubleList(list),ilist);
|
||||
assertEquals(ilist,new ListDoubleList(list));
|
||||
assertEquals(new DoubleListList(ilist),list);
|
||||
assertEquals(list,new DoubleListList(ilist));
|
||||
|
||||
ilist.add((double)1);
|
||||
list.add(new Double((double)1));
|
||||
|
||||
assertTrue("Unwrapped, non-empty List is not equal to non-empty DoubleList.",!ilist.equals(list));
|
||||
assertTrue("Unwrapped, non-empty DoubleList is not equal to non-empty List.",!list.equals(ilist));
|
||||
|
||||
assertEquals(new ListDoubleList(list),ilist);
|
||||
assertEquals(ilist,new ListDoubleList(list));
|
||||
assertEquals(new DoubleListList(ilist),list);
|
||||
assertEquals(list,new DoubleListList(ilist));
|
||||
|
||||
ilist.add((double)1); ilist.add((double)2); ilist.add((double)3); ilist.add((double)5); ilist.add((double)8);
|
||||
list.add(new Double((double)1)); list.add(new Double((double)2)); list.add(new Double((double)3)); list.add(new Double((double)5)); list.add(new Double((double)8));
|
||||
|
||||
assertTrue("Unwrapped, non-empty List is not equal to non-empty DoubleList.",!ilist.equals(list));
|
||||
assertTrue("Unwrapped, non-empty DoubleList is not equal to non-empty List.",!list.equals(ilist));
|
||||
|
||||
assertEquals(new ListDoubleList(list),ilist);
|
||||
assertEquals(ilist,new ListDoubleList(list));
|
||||
assertEquals(new DoubleListList(ilist),list);
|
||||
assertEquals(list,new DoubleListList(ilist));
|
||||
|
||||
}
|
||||
|
||||
public void testClearAndSize() {
|
||||
DoubleList list = makeEmptyDoubleList();
|
||||
assertEquals(0, list.size());
|
||||
for(int i = 0; i < 100; i++) {
|
||||
list.add((double)i);
|
||||
}
|
||||
assertEquals(100, list.size());
|
||||
list.clear();
|
||||
assertEquals(0, list.size());
|
||||
}
|
||||
|
||||
public void testRemoveViaSubList() {
|
||||
DoubleList list = makeEmptyDoubleList();
|
||||
for(int i = 0; i < 100; i++) {
|
||||
list.add((double)i);
|
||||
}
|
||||
DoubleList sub = list.subList(25,75);
|
||||
assertEquals(50,sub.size());
|
||||
for(int i = 0; i < 50; i++) {
|
||||
assertEquals(100-i,list.size());
|
||||
assertEquals(50-i,sub.size());
|
||||
assertEquals((double)(25+i),sub.removeElementAt(0), 0f);
|
||||
assertEquals(50-i-1,sub.size());
|
||||
assertEquals(100-i-1,list.size());
|
||||
}
|
||||
assertEquals(0,sub.size());
|
||||
assertEquals(50,list.size());
|
||||
}
|
||||
|
||||
public void testAddGet() {
|
||||
DoubleList list = makeEmptyDoubleList();
|
||||
for (int i = 0; i < 255; i++) {
|
||||
list.add((double)i);
|
||||
}
|
||||
for (int i = 0; i < 255; i++) {
|
||||
assertEquals((double)i, list.get(i), 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public void testAddAndShift() {
|
||||
DoubleList list = makeEmptyDoubleList();
|
||||
list.add(0, (double)1);
|
||||
assertEquals("Should have one entry", 1, list.size());
|
||||
list.add((double)3);
|
||||
list.add((double)4);
|
||||
list.add(1, (double)2);
|
||||
for(int i = 0; i < 4; i++) {
|
||||
assertEquals("Should get entry back", (double)(i + 1), list.get(i), 0f);
|
||||
}
|
||||
list.add(0, (double)0);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertEquals("Should get entry back", (double)i, list.get(i), 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public void testIsSerializable() throws Exception {
|
||||
DoubleList list = makeFullDoubleList();
|
||||
assertTrue(list instanceof Serializable);
|
||||
byte[] ser = writeExternalFormToBytes((Serializable)list);
|
||||
DoubleList deser = (DoubleList)(readExternalFormFromBytes(ser));
|
||||
assertEquals(list,deser);
|
||||
assertEquals(deser,list);
|
||||
}
|
||||
|
||||
public void testDoubleListSerializeDeserializeThenCompare() throws Exception {
|
||||
DoubleList list = makeFullDoubleList();
|
||||
if(list instanceof Serializable) {
|
||||
byte[] ser = writeExternalFormToBytes((Serializable)list);
|
||||
DoubleList deser = (DoubleList)(readExternalFormFromBytes(ser));
|
||||
assertEquals("obj != deserialize(serialize(obj))",list,deser);
|
||||
}
|
||||
}
|
||||
|
||||
public void testSubListsAreNotSerializable() throws Exception {
|
||||
DoubleList list = makeFullDoubleList().subList(2,3);
|
||||
assertTrue( ! (list instanceof Serializable) );
|
||||
}
|
||||
|
||||
public void testSubListOutOfBounds() throws Exception {
|
||||
try {
|
||||
makeEmptyDoubleList().subList(2,3);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
try {
|
||||
makeFullDoubleList().subList(-1,3);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
makeFullDoubleList().subList(5,2);
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
try {
|
||||
makeFullDoubleList().subList(2,makeFullDoubleList().size()+2);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testListIteratorOutOfBounds() throws Exception {
|
||||
try {
|
||||
makeEmptyDoubleList().listIterator(2);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
try {
|
||||
makeFullDoubleList().listIterator(-1);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
try {
|
||||
makeFullDoubleList().listIterator(makeFullDoubleList().size()+2);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testListIteratorSetWithoutNext() throws Exception {
|
||||
DoubleListIterator iter = makeFullDoubleList().listIterator();
|
||||
try {
|
||||
iter.set((double)3);
|
||||
fail("Expected IllegalStateException");
|
||||
} catch(IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testListIteratorSetAfterRemove() throws Exception {
|
||||
DoubleListIterator iter = makeFullDoubleList().listIterator();
|
||||
iter.next();
|
||||
iter.remove();
|
||||
try {
|
||||
iter.set((double)3);
|
||||
fail("Expected IllegalStateException");
|
||||
} catch(IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestDoubleListIterator.java,v 1.2 2003/08/31 17:28:40 scolebourne 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 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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:40 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public abstract class TestDoubleListIterator extends TestDoubleIterator {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestDoubleListIterator(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public DoubleIterator makeEmptyDoubleIterator() {
|
||||
return makeEmptyDoubleListIterator();
|
||||
}
|
||||
|
||||
public DoubleIterator makeFullDoubleIterator() {
|
||||
return makeFullDoubleListIterator();
|
||||
}
|
||||
|
||||
public abstract DoubleListIterator makeEmptyDoubleListIterator();
|
||||
public abstract DoubleListIterator makeFullDoubleListIterator();
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestFloatIterator.java,v 1.3 2003/10/01 21:54:56 scolebourne 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 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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import org.apache.commons.collections.iterators.AbstractTestIterator;
|
||||
import org.apache.commons.collections.primitives.adapters.FloatIteratorIterator;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:56 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public abstract class TestFloatIterator extends AbstractTestIterator {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestFloatIterator(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public Iterator makeEmptyIterator() {
|
||||
return FloatIteratorIterator.wrap(makeEmptyFloatIterator());
|
||||
}
|
||||
|
||||
public Iterator makeFullIterator() {
|
||||
return FloatIteratorIterator.wrap(makeFullFloatIterator());
|
||||
}
|
||||
|
||||
|
||||
protected abstract FloatIterator makeEmptyFloatIterator();
|
||||
protected abstract FloatIterator makeFullFloatIterator();
|
||||
protected abstract float[] getFullElements();
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public void testNextHasNextRemove() {
|
||||
float[] elements = getFullElements();
|
||||
FloatIterator iter = makeFullFloatIterator();
|
||||
for(int i=0;i<elements.length;i++) {
|
||||
assertTrue(iter.hasNext());
|
||||
assertEquals(elements[i],iter.next(),0f);
|
||||
if(supportsRemove()) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
assertTrue(! iter.hasNext() );
|
||||
}
|
||||
|
||||
public void testEmptyFloatIterator() {
|
||||
assertTrue( ! makeEmptyFloatIterator().hasNext() );
|
||||
try {
|
||||
makeEmptyFloatIterator().next();
|
||||
fail("Expected NoSuchElementException");
|
||||
} catch(NoSuchElementException e) {
|
||||
// expected
|
||||
}
|
||||
if(supportsRemove()) {
|
||||
try {
|
||||
makeEmptyFloatIterator().remove();
|
||||
fail("Expected IllegalStateException");
|
||||
} catch(IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void testRemoveBeforeNext() {
|
||||
if(supportsRemove()) {
|
||||
try {
|
||||
makeFullFloatIterator().remove();
|
||||
fail("Expected IllegalStateException");
|
||||
} catch(IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void testRemoveAfterRemove() {
|
||||
if(supportsRemove()) {
|
||||
FloatIterator iter = makeFullFloatIterator();
|
||||
iter.next();
|
||||
iter.remove();
|
||||
try {
|
||||
iter.remove();
|
||||
fail("Expected IllegalStateException");
|
||||
} catch(IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,425 +0,0 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestFloatList.java,v 1.4 2003/11/16 22:15:11 scolebourne Exp $
|
||||
* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002-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 apache@apache.org.
|
||||
*
|
||||
* 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;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.collections.list.AbstractTestList;
|
||||
import org.apache.commons.collections.primitives.adapters.FloatListList;
|
||||
import org.apache.commons.collections.primitives.adapters.ListFloatList;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.4 $ $Date: 2003/11/16 22:15:11 $
|
||||
* @author Rodney Waldhoff
|
||||
*/
|
||||
public abstract class TestFloatList extends AbstractTestList {
|
||||
|
||||
// conventional
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public TestFloatList(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
// collections testing framework
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// collections testing framework: float list
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
protected abstract FloatList makeEmptyFloatList();
|
||||
|
||||
protected FloatList makeFullFloatList() {
|
||||
FloatList list = makeEmptyFloatList();
|
||||
float[] values = getFullFloats();
|
||||
for(int i=0;i<values.length;i++) {
|
||||
list.add(values[i]);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
protected float[] getFullFloats() {
|
||||
float[] result = new float[19];
|
||||
for(int i = 0; i < result.length; i++) {
|
||||
result[i] = (float)(i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected float[] getOtherFloats() {
|
||||
float[] result = new float[16];
|
||||
for(int i = 0; i < result.length; i++) {
|
||||
result[i] = (float)(i + 43);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// collections testing framework: inherited
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
protected List makeEmptyList() {
|
||||
return new FloatListList(makeEmptyFloatList());
|
||||
}
|
||||
|
||||
protected Object[] getFullElements() {
|
||||
return wrapArray(getFullFloats());
|
||||
}
|
||||
|
||||
protected Object[] getOtherElements() {
|
||||
return wrapArray(getOtherFloats());
|
||||
}
|
||||
|
||||
// private utils
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
private Float[] wrapArray(float[] primitives) {
|
||||
Float[] result = new Float[primitives.length];
|
||||
for(int i=0;i<result.length;i++) {
|
||||
result[i] = new Float(primitives[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// tests
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public void testToJustBigEnoughFloatArray() {
|
||||
FloatList list = makeFullFloatList();
|
||||
float[] dest = new float[list.size()];
|
||||
assertSame(dest,list.toArray(dest));
|
||||
int i=0;
|
||||
for(FloatIterator iter = list.iterator(); iter.hasNext();i++) {
|
||||
assertEquals(iter.next(),dest[i], 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public void testToLargerThanNeededFloatArray() {
|
||||
FloatList list = makeFullFloatList();
|
||||
float[] dest = new float[list.size()*2];
|
||||
for(int i=0;i<dest.length;i++) {
|
||||
dest[i] = Float.MAX_VALUE;
|
||||
}
|
||||
assertSame(dest,list.toArray(dest));
|
||||
int i=0;
|
||||
for(FloatIterator iter = list.iterator(); iter.hasNext();i++) {
|
||||
assertEquals(iter.next(),dest[i], 0f);
|
||||
}
|
||||
for(;i<dest.length;i++) {
|
||||
assertEquals(Float.MAX_VALUE,dest[i], 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public void testToSmallerThanNeededFloatArray() {
|
||||
FloatList list = makeFullFloatList();
|
||||
float[] dest = new float[list.size()/2];
|
||||
float[] dest2 = list.toArray(dest);
|
||||
assertTrue(dest != dest2);
|
||||
int i=0;
|
||||
for(FloatIterator iter = list.iterator(); iter.hasNext();i++) {
|
||||
assertEquals(iter.next(),dest2[i], 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public void testHashCodeSpecification() {
|
||||
FloatList list = makeFullFloatList();
|
||||
int hash = 1;
|
||||
for(FloatIterator iter = list.iterator(); iter.hasNext(); ) {
|
||||
hash = 31*hash + Float.floatToIntBits(iter.next());
|
||||
}
|
||||
assertEquals(hash,list.hashCode());
|
||||
}
|
||||
|
||||
public void testEqualsWithTwoFloatLists() {
|
||||
FloatList one = makeEmptyFloatList();
|
||||
assertEquals("Equals is reflexive on empty list",one,one);
|
||||
FloatList two = makeEmptyFloatList();
|
||||
assertEquals("Empty lists are equal",one,two);
|
||||
assertEquals("Equals is symmetric on empty lists",two,one);
|
||||
|
||||
one.add((float)1);
|
||||
assertEquals("Equals is reflexive on non empty list",one,one);
|
||||
assertTrue(!one.equals(two));
|
||||
assertTrue(!two.equals(one));
|
||||
|
||||
two.add((float)1);
|
||||
assertEquals("Non empty lists are equal",one,two);
|
||||
assertEquals("Equals is symmetric on non empty list",one,two);
|
||||
|
||||
one.add((float)1); one.add((float)2); one.add((float)3); one.add((float)5); one.add((float)8);
|
||||
assertEquals("Equals is reflexive on larger non empty list",one,one);
|
||||
assertTrue(!one.equals(two));
|
||||
assertTrue(!two.equals(one));
|
||||
|
||||
two.add((float)1); two.add((float)2); two.add((float)3); two.add((float)5); two.add((float)8);
|
||||
assertEquals("Larger non empty lists are equal",one,two);
|
||||
assertEquals("Equals is symmetric on larger non empty list",two,one);
|
||||
|
||||
one.add((float)9);
|
||||
two.add((float)10);
|
||||
assertTrue(!one.equals(two));
|
||||
assertTrue(!two.equals(one));
|
||||
|
||||
}
|
||||
|
||||
public void testFloatSubListEquals() {
|
||||
FloatList one = makeEmptyFloatList();
|
||||
assertEquals(one,one.subList(0,0));
|
||||
assertEquals(one.subList(0,0),one);
|
||||
|
||||
one.add((float)1);
|
||||
assertEquals(one,one.subList(0,1));
|
||||
assertEquals(one.subList(0,1),one);
|
||||
|
||||
one.add((float)1); one.add((float)2); one.add((float)3); one.add((float)5); one.add((float)8);
|
||||
assertEquals(one.subList(0,4),one.subList(0,4));
|
||||
assertEquals(one.subList(3,5),one.subList(3,5));
|
||||
}
|
||||
|
||||
public void testEqualsWithFloatListAndList() {
|
||||
FloatList ilist = makeEmptyFloatList();
|
||||
List list = new ArrayList();
|
||||
|
||||
assertTrue("Unwrapped, empty List should not be equal to empty FloatList.",!ilist.equals(list));
|
||||
assertTrue("Unwrapped, empty FloatList should not be equal to empty List.",!list.equals(ilist));
|
||||
|
||||
assertEquals(new ListFloatList(list),ilist);
|
||||
assertEquals(ilist,new ListFloatList(list));
|
||||
assertEquals(new FloatListList(ilist),list);
|
||||
assertEquals(list,new FloatListList(ilist));
|
||||
|
||||
ilist.add((float)1);
|
||||
list.add(new Float((float)1));
|
||||
|
||||
assertTrue("Unwrapped, non-empty List is not equal to non-empty FloatList.",!ilist.equals(list));
|
||||
assertTrue("Unwrapped, non-empty FloatList is not equal to non-empty List.",!list.equals(ilist));
|
||||
|
||||
assertEquals(new ListFloatList(list),ilist);
|
||||
assertEquals(ilist,new ListFloatList(list));
|
||||
assertEquals(new FloatListList(ilist),list);
|
||||
assertEquals(list,new FloatListList(ilist));
|
||||
|
||||
ilist.add((float)1); ilist.add((float)2); ilist.add((float)3); ilist.add((float)5); ilist.add((float)8);
|
||||
list.add(new Float((float)1)); list.add(new Float((float)2)); list.add(new Float((float)3)); list.add(new Float((float)5)); list.add(new Float((float)8));
|
||||
|
||||
assertTrue("Unwrapped, non-empty List is not equal to non-empty FloatList.",!ilist.equals(list));
|
||||
assertTrue("Unwrapped, non-empty FloatList is not equal to non-empty List.",!list.equals(ilist));
|
||||
|
||||
assertEquals(new ListFloatList(list),ilist);
|
||||
assertEquals(ilist,new ListFloatList(list));
|
||||
assertEquals(new FloatListList(ilist),list);
|
||||
assertEquals(list,new FloatListList(ilist));
|
||||
|
||||
}
|
||||
|
||||
public void testClearAndSize() {
|
||||
FloatList list = makeEmptyFloatList();
|
||||
assertEquals(0, list.size());
|
||||
for(int i = 0; i < 100; i++) {
|
||||
list.add((float)i);
|
||||
}
|
||||
assertEquals(100, list.size());
|
||||
list.clear();
|
||||
assertEquals(0, list.size());
|
||||
}
|
||||
|
||||
public void testRemoveViaSubList() {
|
||||
FloatList list = makeEmptyFloatList();
|
||||
for(int i = 0; i < 100; i++) {
|
||||
list.add((float)i);
|
||||
}
|
||||
FloatList sub = list.subList(25,75);
|
||||
assertEquals(50,sub.size());
|
||||
for(int i = 0; i < 50; i++) {
|
||||
assertEquals(100-i,list.size());
|
||||
assertEquals(50-i,sub.size());
|
||||
assertEquals((float)(25+i),sub.removeElementAt(0), 0f);
|
||||
assertEquals(50-i-1,sub.size());
|
||||
assertEquals(100-i-1,list.size());
|
||||
}
|
||||
assertEquals(0,sub.size());
|
||||
assertEquals(50,list.size());
|
||||
}
|
||||
|
||||
public void testAddGet() {
|
||||
FloatList list = makeEmptyFloatList();
|
||||
for (int i = 0; i < 255; i++) {
|
||||
list.add((float)i);
|
||||
}
|
||||
for (int i = 0; i < 255; i++) {
|
||||
assertEquals((float)i, list.get(i), 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public void testAddAndShift() {
|
||||
FloatList list = makeEmptyFloatList();
|
||||
list.add(0, (float)1);
|
||||
assertEquals("Should have one entry", 1, list.size());
|
||||
list.add((float)3);
|
||||
list.add((float)4);
|
||||
list.add(1, (float)2);
|
||||
for(int i = 0; i < 4; i++) {
|
||||
assertEquals("Should get entry back", (float)(i + 1), list.get(i), 0f);
|
||||
}
|
||||
list.add(0, (float)0);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertEquals("Should get entry back", (float)i, list.get(i), 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public void testIsSerializable() throws Exception {
|
||||
FloatList list = makeFullFloatList();
|
||||
assertTrue(list instanceof Serializable);
|
||||
byte[] ser = writeExternalFormToBytes((Serializable)list);
|
||||
FloatList deser = (FloatList)(readExternalFormFromBytes(ser));
|
||||
assertEquals(list,deser);
|
||||
assertEquals(deser,list);
|
||||
}
|
||||
|
||||
public void testFloatListSerializeDeserializeThenCompare() throws Exception {
|
||||
FloatList list = makeFullFloatList();
|
||||
if(list instanceof Serializable) {
|
||||
byte[] ser = writeExternalFormToBytes((Serializable)list);
|
||||
FloatList deser = (FloatList)(readExternalFormFromBytes(ser));
|
||||
assertEquals("obj != deserialize(serialize(obj))",list,deser);
|
||||
}
|
||||
}
|
||||
|
||||
public void testSubListsAreNotSerializable() throws Exception {
|
||||
FloatList list = makeFullFloatList().subList(2,3);
|
||||
assertTrue( ! (list instanceof Serializable) );
|
||||
}
|
||||
|
||||
public void testSubListOutOfBounds() throws Exception {
|
||||
try {
|
||||
makeEmptyFloatList().subList(2,3);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
try {
|
||||
makeFullFloatList().subList(-1,3);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
makeFullFloatList().subList(5,2);
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch(IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
try {
|
||||
makeFullFloatList().subList(2,makeFullFloatList().size()+2);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testListIteratorOutOfBounds() throws Exception {
|
||||
try {
|
||||
makeEmptyFloatList().listIterator(2);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
try {
|
||||
makeFullFloatList().listIterator(-1);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
try {
|
||||
makeFullFloatList().listIterator(makeFullFloatList().size()+2);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
} catch(IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testListIteratorSetWithoutNext() throws Exception {
|
||||
FloatListIterator iter = makeFullFloatList().listIterator();
|
||||
try {
|
||||
iter.set((float)3);
|
||||
fail("Expected IllegalStateException");
|
||||
} catch(IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testListIteratorSetAfterRemove() throws Exception {
|
||||
FloatListIterator iter = makeFullFloatList().listIterator();
|
||||
iter.next();
|
||||
iter.remove();
|
||||
try {
|
||||
iter.set((float)3);
|
||||
fail("Expected IllegalStateException");
|
||||
} catch(IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue