Renamed collection tests.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1369988 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c8b641ee6e
commit
bdea1ff900
|
@ -36,7 +36,7 @@ import org.apache.commons.collections.keyvalue.DefaultMapEntry;
|
||||||
import org.apache.commons.collections.map.HashedMap;
|
import org.apache.commons.collections.map.HashedMap;
|
||||||
import org.apache.commons.collections.map.LazyMap;
|
import org.apache.commons.collections.map.LazyMap;
|
||||||
import org.apache.commons.collections.map.PredicatedMap;
|
import org.apache.commons.collections.map.PredicatedMap;
|
||||||
import org.apache.commons.collections.collection.TestTransformedCollection;
|
import org.apache.commons.collections.collection.TransformedCollectionTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for MapUtils.
|
* Tests for MapUtils.
|
||||||
|
@ -756,7 +756,7 @@ public class TestMapUtils extends BulkTest {
|
||||||
|
|
||||||
// Now test key transform population
|
// Now test key transform population
|
||||||
Map<Object, Object> map = new HashMap<Object, Object>();
|
Map<Object, Object> map = new HashMap<Object, Object>();
|
||||||
MapUtils.populateMap(map, list, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
MapUtils.populateMap(map, list, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
assertEquals(list.size(), map.size());
|
assertEquals(list.size(), map.size());
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
@ -768,7 +768,7 @@ public class TestMapUtils extends BulkTest {
|
||||||
|
|
||||||
// Now test both Key-Value transform population
|
// Now test both Key-Value transform population
|
||||||
map = new HashMap<Object, Object>();
|
map = new HashMap<Object, Object>();
|
||||||
MapUtils.populateMap(map, list, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
MapUtils.populateMap(map, list, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
|
|
||||||
assertEquals(list.size(), map.size());
|
assertEquals(list.size(), map.size());
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.commons.collections.bag;
|
||||||
|
|
||||||
import org.apache.commons.collections.Bag;
|
import org.apache.commons.collections.Bag;
|
||||||
import org.apache.commons.collections.Transformer;
|
import org.apache.commons.collections.Transformer;
|
||||||
import org.apache.commons.collections.collection.TestTransformedCollection;
|
import org.apache.commons.collections.collection.TransformedCollectionTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of {@link AbstractBagTest} for exercising the {@link TransformedBag}
|
* Extension of {@link AbstractBagTest} for exercising the {@link TransformedBag}
|
||||||
|
@ -37,14 +37,14 @@ public class TransformedBagTest<T> extends AbstractBagTest<T> {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Bag<T> makeObject() {
|
public Bag<T> makeObject() {
|
||||||
return TransformedBag.transformingBag(new HashBag<T>(),
|
return TransformedBag.transformingBag(new HashBag<T>(),
|
||||||
(Transformer<T, T>) TestTransformedCollection.NOOP_TRANSFORMER);
|
(Transformer<T, T>) TransformedCollectionTest.NOOP_TRANSFORMER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void testTransformedBag() {
|
public void testTransformedBag() {
|
||||||
//T had better be Object!
|
//T had better be Object!
|
||||||
Bag<T> bag = TransformedBag.transformingBag(new HashBag<T>(),
|
Bag<T> bag = TransformedBag.transformingBag(new HashBag<T>(),
|
||||||
(Transformer<T, T>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
(Transformer<T, T>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
assertEquals(0, bag.size());
|
assertEquals(0, bag.size());
|
||||||
Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
|
Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
|
@ -66,7 +66,7 @@ public class TransformedBagTest<T> extends AbstractBagTest<T> {
|
||||||
originalBag.add((T) els[i]);
|
originalBag.add((T) els[i]);
|
||||||
}
|
}
|
||||||
Bag<T> bag = TransformedBag.transformedBag(originalBag,
|
Bag<T> bag = TransformedBag.transformedBag(originalBag,
|
||||||
(Transformer<T, T>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
(Transformer<T, T>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
assertEquals(els.length, bag.size());
|
assertEquals(els.length, bag.size());
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
assertEquals(true, bag.contains(new Integer((String) els[i])));
|
assertEquals(true, bag.contains(new Integer((String) els[i])));
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.commons.collections.bag;
|
||||||
import org.apache.commons.collections.Bag;
|
import org.apache.commons.collections.Bag;
|
||||||
import org.apache.commons.collections.SortedBag;
|
import org.apache.commons.collections.SortedBag;
|
||||||
import org.apache.commons.collections.Transformer;
|
import org.apache.commons.collections.Transformer;
|
||||||
import org.apache.commons.collections.collection.TestTransformedCollection;
|
import org.apache.commons.collections.collection.TransformedCollectionTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of {@link AbstractSortedBagTest} for exercising the {@link TransformedSortedBag}
|
* Extension of {@link AbstractSortedBagTest} for exercising the {@link TransformedSortedBag}
|
||||||
|
@ -37,12 +37,12 @@ public class TransformedSortedBagTest<T> extends AbstractSortedBagTest<T> {
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public SortedBag<T> makeObject() {
|
public SortedBag<T> makeObject() {
|
||||||
return TransformedSortedBag.transformingSortedBag(new TreeBag<T>(), (Transformer<T, T>) TestTransformedCollection.NOOP_TRANSFORMER);
|
return TransformedSortedBag.transformingSortedBag(new TreeBag<T>(), (Transformer<T, T>) TransformedCollectionTest.NOOP_TRANSFORMER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void testTransformedBag() {
|
public void testTransformedBag() {
|
||||||
SortedBag<T> bag = TransformedSortedBag.transformingSortedBag(new TreeBag<T>(), (Transformer<T, T>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
SortedBag<T> bag = TransformedSortedBag.transformingSortedBag(new TreeBag<T>(), (Transformer<T, T>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
assertEquals(0, bag.size());
|
assertEquals(0, bag.size());
|
||||||
Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
|
Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
|
@ -61,7 +61,7 @@ public class TransformedSortedBagTest<T> extends AbstractSortedBagTest<T> {
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
originalBag.add(els[i]);
|
originalBag.add(els[i]);
|
||||||
}
|
}
|
||||||
Bag<?> bag = TransformedBag.transformedBag(originalBag, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
Bag<?> bag = TransformedBag.transformedBag(originalBag, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
assertEquals(els.length, bag.size());
|
assertEquals(els.length, bag.size());
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
assertEquals(true, bag.contains(new Integer((String) els[i])));
|
assertEquals(true, bag.contains(new Integer((String) els[i])));
|
||||||
|
|
|
@ -25,7 +25,7 @@ import junit.framework.Test;
|
||||||
|
|
||||||
import org.apache.commons.collections.BufferUnderflowException;
|
import org.apache.commons.collections.BufferUnderflowException;
|
||||||
import org.apache.commons.collections.BulkTest;
|
import org.apache.commons.collections.BulkTest;
|
||||||
import org.apache.commons.collections.collection.AbstractTestCollection;
|
import org.apache.commons.collections.collection.AbstractCollectionTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test cases for BoundedFifoBuffer.
|
* Test cases for BoundedFifoBuffer.
|
||||||
|
@ -34,7 +34,7 @@ import org.apache.commons.collections.collection.AbstractTestCollection;
|
||||||
*
|
*
|
||||||
* @author Paul Jack
|
* @author Paul Jack
|
||||||
*/
|
*/
|
||||||
public class TestBoundedFifoBuffer<E> extends AbstractTestCollection<E> {
|
public class TestBoundedFifoBuffer<E> extends AbstractCollectionTest<E> {
|
||||||
|
|
||||||
public TestBoundedFifoBuffer(String n) {
|
public TestBoundedFifoBuffer(String n) {
|
||||||
super(n);
|
super(n);
|
||||||
|
|
|
@ -29,7 +29,7 @@ import junit.framework.Test;
|
||||||
import org.apache.commons.collections.Buffer;
|
import org.apache.commons.collections.Buffer;
|
||||||
import org.apache.commons.collections.BufferUnderflowException;
|
import org.apache.commons.collections.BufferUnderflowException;
|
||||||
import org.apache.commons.collections.BulkTest;
|
import org.apache.commons.collections.BulkTest;
|
||||||
import org.apache.commons.collections.collection.AbstractTestCollection;
|
import org.apache.commons.collections.collection.AbstractCollectionTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test cases for CircularFifoBuffer.
|
* Test cases for CircularFifoBuffer.
|
||||||
|
@ -38,7 +38,7 @@ import org.apache.commons.collections.collection.AbstractTestCollection;
|
||||||
*
|
*
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
public class TestCircularFifoBuffer<E> extends AbstractTestCollection<E> {
|
public class TestCircularFifoBuffer<E> extends AbstractCollectionTest<E> {
|
||||||
|
|
||||||
public TestCircularFifoBuffer(String n) {
|
public TestCircularFifoBuffer(String n) {
|
||||||
super(n);
|
super(n);
|
||||||
|
|
|
@ -22,10 +22,10 @@ import org.apache.commons.collections.ArrayStack;
|
||||||
import org.apache.commons.collections.Buffer;
|
import org.apache.commons.collections.Buffer;
|
||||||
import org.apache.commons.collections.BufferUnderflowException;
|
import org.apache.commons.collections.BufferUnderflowException;
|
||||||
import org.apache.commons.collections.Predicate;
|
import org.apache.commons.collections.Predicate;
|
||||||
import org.apache.commons.collections.collection.TestPredicatedCollection;
|
import org.apache.commons.collections.collection.PredicatedCollectionTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of {@link TestPredicatedCollection} for exercising the
|
* Extension of {@link PredicatedCollectionTest} for exercising the
|
||||||
* {@link PredicatedBuffer} implementation.
|
* {@link PredicatedBuffer} implementation.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
|
@ -33,7 +33,7 @@ import org.apache.commons.collections.collection.TestPredicatedCollection;
|
||||||
*
|
*
|
||||||
* @author Phil Steitz
|
* @author Phil Steitz
|
||||||
*/
|
*/
|
||||||
public class TestPredicatedBuffer<E> extends TestPredicatedCollection<E> {
|
public class TestPredicatedBuffer<E> extends PredicatedCollectionTest<E> {
|
||||||
|
|
||||||
public TestPredicatedBuffer(String testName) {
|
public TestPredicatedBuffer(String testName) {
|
||||||
super(testName);
|
super(testName);
|
||||||
|
|
|
@ -27,7 +27,7 @@ import java.util.Random;
|
||||||
import org.apache.commons.collections.Buffer;
|
import org.apache.commons.collections.Buffer;
|
||||||
import org.apache.commons.collections.BufferUnderflowException;
|
import org.apache.commons.collections.BufferUnderflowException;
|
||||||
import org.apache.commons.collections.ComparatorUtils;
|
import org.apache.commons.collections.ComparatorUtils;
|
||||||
import org.apache.commons.collections.collection.AbstractTestCollection;
|
import org.apache.commons.collections.collection.AbstractCollectionTest;
|
||||||
import org.apache.commons.collections.comparators.ComparableComparator;
|
import org.apache.commons.collections.comparators.ComparableComparator;
|
||||||
import org.apache.commons.collections.comparators.ReverseComparator;
|
import org.apache.commons.collections.comparators.ReverseComparator;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ import org.apache.commons.collections.comparators.ReverseComparator;
|
||||||
* @author Steve Phelps
|
* @author Steve Phelps
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("boxing")
|
@SuppressWarnings("boxing")
|
||||||
public class TestPriorityBuffer<E> extends AbstractTestCollection<E> {
|
public class TestPriorityBuffer<E> extends AbstractCollectionTest<E> {
|
||||||
|
|
||||||
public TestPriorityBuffer(String testName) {
|
public TestPriorityBuffer(String testName) {
|
||||||
super(testName);
|
super(testName);
|
||||||
|
|
|
@ -21,10 +21,10 @@ import java.util.Collection;
|
||||||
|
|
||||||
import org.apache.commons.collections.ArrayStack;
|
import org.apache.commons.collections.ArrayStack;
|
||||||
import org.apache.commons.collections.Buffer;
|
import org.apache.commons.collections.Buffer;
|
||||||
import org.apache.commons.collections.collection.AbstractTestCollection;
|
import org.apache.commons.collections.collection.AbstractCollectionTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of {@link AbstractTestCollection} for exercising the
|
* Extension of {@link AbstractCollectionTest} for exercising the
|
||||||
* {@link SynchronizedBuffer} implementation.
|
* {@link SynchronizedBuffer} implementation.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.1
|
* @since Commons Collections 3.1
|
||||||
|
@ -33,7 +33,7 @@ import org.apache.commons.collections.collection.AbstractTestCollection;
|
||||||
* @author Phil Steitz
|
* @author Phil Steitz
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
public class TestSynchronizedBuffer<E> extends AbstractTestCollection<E> {
|
public class TestSynchronizedBuffer<E> extends AbstractCollectionTest<E> {
|
||||||
|
|
||||||
public TestSynchronizedBuffer(String testName) {
|
public TestSynchronizedBuffer(String testName) {
|
||||||
super(testName);
|
super(testName);
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.commons.collections.buffer;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import org.apache.commons.collections.ArrayStack;
|
import org.apache.commons.collections.ArrayStack;
|
||||||
import org.apache.commons.collections.Buffer;
|
import org.apache.commons.collections.Buffer;
|
||||||
import org.apache.commons.collections.collection.TestTransformedCollection;
|
import org.apache.commons.collections.collection.TransformedCollectionTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of {@link TestCase} for exercising the {@link TransformedBuffer}
|
* Extension of {@link TestCase} for exercising the {@link TransformedBuffer}
|
||||||
|
@ -37,7 +37,7 @@ public class TestTransformedBuffer extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testTransformedBuffer() {
|
public void testTransformedBuffer() {
|
||||||
Buffer<Object> buffer = TransformedBuffer.transformingBuffer(new ArrayStack<Object>(), TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
Buffer<Object> buffer = TransformedBuffer.transformingBuffer(new ArrayStack<Object>(), TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
assertEquals(0, buffer.size());
|
assertEquals(0, buffer.size());
|
||||||
Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" };
|
Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" };
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
|
@ -58,7 +58,7 @@ public class TestTransformedBuffer extends TestCase {
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
originalBuffer.add(els[i]);
|
originalBuffer.add(els[i]);
|
||||||
}
|
}
|
||||||
Buffer buffer = TransformedBuffer.transformedBuffer(originalBuffer, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
Buffer buffer = TransformedBuffer.transformedBuffer(originalBuffer, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
assertEquals(els.length, buffer.size());
|
assertEquals(els.length, buffer.size());
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
assertEquals(true, buffer.contains(new Integer((String) els[i])));
|
assertEquals(true, buffer.contains(new Integer((String) els[i])));
|
||||||
|
|
|
@ -24,7 +24,7 @@ import java.util.List;
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
|
||||||
import org.apache.commons.collections.BulkTest;
|
import org.apache.commons.collections.BulkTest;
|
||||||
import org.apache.commons.collections.collection.AbstractTestCollection;
|
import org.apache.commons.collections.collection.AbstractCollectionTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test cases for UnboundedFifoBuffer.
|
* Test cases for UnboundedFifoBuffer.
|
||||||
|
@ -33,7 +33,7 @@ import org.apache.commons.collections.collection.AbstractTestCollection;
|
||||||
*
|
*
|
||||||
* @author Unknown
|
* @author Unknown
|
||||||
*/
|
*/
|
||||||
public class TestUnboundedFifoBuffer<E> extends AbstractTestCollection<E> {
|
public class TestUnboundedFifoBuffer<E> extends AbstractCollectionTest<E> {
|
||||||
|
|
||||||
public TestUnboundedFifoBuffer(String n) {
|
public TestUnboundedFifoBuffer(String n) {
|
||||||
super(n);
|
super(n);
|
||||||
|
|
|
@ -21,10 +21,10 @@ import java.util.Collection;
|
||||||
|
|
||||||
import org.apache.commons.collections.ArrayStack;
|
import org.apache.commons.collections.ArrayStack;
|
||||||
import org.apache.commons.collections.Buffer;
|
import org.apache.commons.collections.Buffer;
|
||||||
import org.apache.commons.collections.collection.AbstractTestCollection;
|
import org.apache.commons.collections.collection.AbstractCollectionTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of {@link AbstractTestCollection} for exercising the
|
* Extension of {@link AbstractCollectionTest} for exercising the
|
||||||
* {@link UnmodifiableBuffer} implementation.
|
* {@link UnmodifiableBuffer} implementation.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.1
|
* @since Commons Collections 3.1
|
||||||
|
@ -33,7 +33,7 @@ import org.apache.commons.collections.collection.AbstractTestCollection;
|
||||||
* @author Phil Steitz
|
* @author Phil Steitz
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
public class TestUnmodifiableBuffer<E> extends AbstractTestCollection<E> {
|
public class TestUnmodifiableBuffer<E> extends AbstractCollectionTest<E> {
|
||||||
|
|
||||||
public TestUnmodifiableBuffer(String testName) {
|
public TestUnmodifiableBuffer(String testName) {
|
||||||
super(testName);
|
super(testName);
|
||||||
|
|
|
@ -125,7 +125,7 @@ import org.apache.commons.collections.AbstractTestObject;
|
||||||
* @author Neil O'Toole
|
* @author Neil O'Toole
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractTestCollection<E> extends AbstractTestObject {
|
public abstract class AbstractCollectionTest<E> extends AbstractTestObject {
|
||||||
|
|
||||||
//
|
//
|
||||||
// NOTE:
|
// NOTE:
|
||||||
|
@ -160,7 +160,7 @@ public abstract class AbstractTestCollection<E> extends AbstractTestObject {
|
||||||
*
|
*
|
||||||
* @param testName the test class name
|
* @param testName the test class name
|
||||||
*/
|
*/
|
||||||
public AbstractTestCollection(String testName) {
|
public AbstractCollectionTest(String testName) {
|
||||||
super(testName);
|
super(testName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of {@link AbstractTestCollection} for exercising the
|
* Extension of {@link AbstractCollectionTest} for exercising the
|
||||||
* {@link CompositeCollection} implementation.
|
* {@link CompositeCollection} implementation.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
|
@ -33,9 +33,9 @@ import java.util.List;
|
||||||
* @author Brian McCallister
|
* @author Brian McCallister
|
||||||
* @author Phil Steitz
|
* @author Phil Steitz
|
||||||
*/
|
*/
|
||||||
public class TestCompositeCollection<E> extends AbstractTestCollection<E> {
|
public class CompositeCollectionTest<E> extends AbstractCollectionTest<E> {
|
||||||
|
|
||||||
public TestCompositeCollection(String name) {
|
public CompositeCollectionTest(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.commons.collections.Predicate;
|
||||||
import org.apache.commons.collections.functors.TruePredicate;
|
import org.apache.commons.collections.functors.TruePredicate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of {@link AbstractTestCollection} for exercising the
|
* Extension of {@link AbstractCollectionTest} for exercising the
|
||||||
* {@link PredicatedCollection} implementation.
|
* {@link PredicatedCollection} implementation.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
|
@ -33,9 +33,9 @@ import org.apache.commons.collections.functors.TruePredicate;
|
||||||
*
|
*
|
||||||
* @author Phil Steitz
|
* @author Phil Steitz
|
||||||
*/
|
*/
|
||||||
public class TestPredicatedCollection<E> extends AbstractTestCollection<E> {
|
public class PredicatedCollectionTest<E> extends AbstractCollectionTest<E> {
|
||||||
|
|
||||||
public TestPredicatedCollection(String name) {
|
public PredicatedCollectionTest(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of {@link AbstractTestCollection} for exercising the
|
* Extension of {@link AbstractCollectionTest} for exercising the
|
||||||
* {@link SynchronizedCollection} implementation.
|
* {@link SynchronizedCollection} implementation.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.1
|
* @since Commons Collections 3.1
|
||||||
|
@ -30,9 +30,9 @@ import java.util.Collection;
|
||||||
* @author Phil Steitz
|
* @author Phil Steitz
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
public class TestSynchronizedCollection<E> extends AbstractTestCollection<E> {
|
public class SynchronizedCollectionTest<E> extends AbstractCollectionTest<E> {
|
||||||
|
|
||||||
public TestSynchronizedCollection(String testName) {
|
public SynchronizedCollectionTest(String testName) {
|
||||||
super(testName);
|
super(testName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.commons.collections.Transformer;
|
||||||
import org.apache.commons.collections.TransformerUtils;
|
import org.apache.commons.collections.TransformerUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of {@link AbstractTestCollection} for exercising the {@link TransformedCollection}
|
* Extension of {@link AbstractCollectionTest} for exercising the {@link TransformedCollection}
|
||||||
* implementation.
|
* implementation.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
|
@ -33,7 +33,7 @@ import org.apache.commons.collections.TransformerUtils;
|
||||||
*
|
*
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
public class TestTransformedCollection extends AbstractTestCollection<Object> {
|
public class TransformedCollectionTest extends AbstractCollectionTest<Object> {
|
||||||
|
|
||||||
private static class StringToInteger implements Transformer<Object, Object> {
|
private static class StringToInteger implements Transformer<Object, Object> {
|
||||||
public Object transform(Object input) {
|
public Object transform(Object input) {
|
||||||
|
@ -44,7 +44,7 @@ public class TestTransformedCollection extends AbstractTestCollection<Object> {
|
||||||
public static final Transformer<Object, Object> NOOP_TRANSFORMER = TransformerUtils.nopTransformer();
|
public static final Transformer<Object, Object> NOOP_TRANSFORMER = TransformerUtils.nopTransformer();
|
||||||
public static final Transformer<Object, Object> STRING_TO_INTEGER_TRANSFORMER = new StringToInteger();
|
public static final Transformer<Object, Object> STRING_TO_INTEGER_TRANSFORMER = new StringToInteger();
|
||||||
|
|
||||||
public TestTransformedCollection(String testName) {
|
public TransformedCollectionTest(String testName) {
|
||||||
super(testName);
|
super(testName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ public class TestTransformedCollection extends AbstractTestCollection<Object> {
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
originalCollection.add(els[i]);
|
originalCollection.add(els[i]);
|
||||||
}
|
}
|
||||||
Collection collection = TransformedCollection.transformedCollection(originalCollection, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
Collection<Object> collection = TransformedCollection.transformedCollection(originalCollection, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
assertEquals(els.length, collection.size());
|
assertEquals(els.length, collection.size());
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
assertEquals(true, collection.contains(new Integer((String) els[i])));
|
assertEquals(true, collection.contains(new Integer((String) els[i])));
|
|
@ -26,12 +26,12 @@ import org.apache.commons.collections.BufferUtils;
|
||||||
import org.apache.commons.collections.buffer.BoundedBuffer;
|
import org.apache.commons.collections.buffer.BoundedBuffer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of {@link AbstractTestCollection} for exercising the
|
* Extension of {@link AbstractCollectionTest} for exercising the
|
||||||
* {@link UnmodifiableBoundedCollection} implementation.
|
* {@link UnmodifiableBoundedCollection} implementation.
|
||||||
*/
|
*/
|
||||||
public class TestUnmodifiableBoundedCollection<E> extends AbstractTestCollection<E> {
|
public class UnmodifiableBoundedCollectionTest<E> extends AbstractCollectionTest<E> {
|
||||||
|
|
||||||
public TestUnmodifiableBoundedCollection(String testName) {
|
public UnmodifiableBoundedCollectionTest(String testName) {
|
||||||
super(testName);
|
super(testName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of {@link AbstractTestCollection} for exercising the
|
* Extension of {@link AbstractCollectionTest} for exercising the
|
||||||
* {@link UnmodifiableCollection} implementation.
|
* {@link UnmodifiableCollection} implementation.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
|
@ -31,9 +31,9 @@ import java.util.List;
|
||||||
* @author Phil Steitz
|
* @author Phil Steitz
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
*/
|
*/
|
||||||
public class TestUnmodifiableCollection<E> extends AbstractTestCollection<E> {
|
public class UnmodifiableCollectionTest<E> extends AbstractCollectionTest<E> {
|
||||||
|
|
||||||
public TestUnmodifiableCollection(String testName) {
|
public UnmodifiableCollectionTest(String testName) {
|
||||||
super(testName);
|
super(testName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ import java.util.ListIterator;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
import org.apache.commons.collections.BulkTest;
|
import org.apache.commons.collections.BulkTest;
|
||||||
import org.apache.commons.collections.collection.AbstractTestCollection;
|
import org.apache.commons.collections.collection.AbstractCollectionTest;
|
||||||
import org.apache.commons.collections.iterators.AbstractTestListIterator;
|
import org.apache.commons.collections.iterators.AbstractTestListIterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,7 +53,7 @@ import org.apache.commons.collections.iterators.AbstractTestListIterator;
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
* @author Neil O'Toole
|
* @author Neil O'Toole
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractTestList<E> extends AbstractTestCollection<E> {
|
public abstract class AbstractTestList<E> extends AbstractCollectionTest<E> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JUnit constructor.
|
* JUnit constructor.
|
||||||
|
|
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
|
||||||
import org.apache.commons.collections.Transformer;
|
import org.apache.commons.collections.Transformer;
|
||||||
import org.apache.commons.collections.collection.TestTransformedCollection;
|
import org.apache.commons.collections.collection.TransformedCollectionTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of {@link AbstractTestList} for exercising the {@link TransformedList}
|
* Extension of {@link AbstractTestList} for exercising the {@link TransformedList}
|
||||||
|
@ -54,7 +54,7 @@ public class TestTransformedList<E> extends AbstractTestList<E> {
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public List<E> makeObject() {
|
public List<E> makeObject() {
|
||||||
return TransformedList.transformingList(new ArrayList<E>(), (Transformer<E, E>) TestTransformedCollection.NOOP_TRANSFORMER);
|
return TransformedList.transformingList(new ArrayList<E>(), (Transformer<E, E>) TransformedCollectionTest.NOOP_TRANSFORMER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -62,12 +62,12 @@ public class TestTransformedList<E> extends AbstractTestList<E> {
|
||||||
public List<E> makeFullCollection() {
|
public List<E> makeFullCollection() {
|
||||||
List<E> list = new ArrayList<E>();
|
List<E> list = new ArrayList<E>();
|
||||||
list.addAll(Arrays.asList(getFullElements()));
|
list.addAll(Arrays.asList(getFullElements()));
|
||||||
return TransformedList.transformingList(list, (Transformer<E, E>) TestTransformedCollection.NOOP_TRANSFORMER);
|
return TransformedList.transformingList(list, (Transformer<E, E>) TransformedCollectionTest.NOOP_TRANSFORMER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void testTransformedList() {
|
public void testTransformedList() {
|
||||||
List<E> list = TransformedList.transformingList(new ArrayList<E>(), (Transformer<E, E>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
List<E> list = TransformedList.transformingList(new ArrayList<E>(), (Transformer<E, E>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
assertEquals(0, list.size());
|
assertEquals(0, list.size());
|
||||||
E[] els = (E[]) new Object[] {"1", "3", "5", "7", "2", "4", "6"};
|
E[] els = (E[]) new Object[] {"1", "3", "5", "7", "2", "4", "6"};
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
|
@ -119,7 +119,7 @@ public class TestTransformedList<E> extends AbstractTestList<E> {
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
originalList.add(els[i]);
|
originalList.add(els[i]);
|
||||||
}
|
}
|
||||||
List<?> list = TransformedList.transformedList(originalList, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
List<?> list = TransformedList.transformedList(originalList, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
assertEquals(els.length, list.size());
|
assertEquals(els.length, list.size());
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
assertEquals(true, list.contains(new Integer((String) els[i])));
|
assertEquals(true, list.contains(new Integer((String) els[i])));
|
||||||
|
|
|
@ -32,14 +32,14 @@ import java.util.Set;
|
||||||
import org.apache.commons.collections.AbstractTestObject;
|
import org.apache.commons.collections.AbstractTestObject;
|
||||||
import org.apache.commons.collections.BulkTest;
|
import org.apache.commons.collections.BulkTest;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.collections.collection.AbstractTestCollection;
|
import org.apache.commons.collections.collection.AbstractCollectionTest;
|
||||||
import org.apache.commons.collections.keyvalue.DefaultMapEntry;
|
import org.apache.commons.collections.keyvalue.DefaultMapEntry;
|
||||||
import org.apache.commons.collections.set.AbstractTestSet;
|
import org.apache.commons.collections.set.AbstractTestSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract test class for {@link java.util.Map} methods and contracts.
|
* Abstract test class for {@link java.util.Map} methods and contracts.
|
||||||
* <p>
|
* <p>
|
||||||
* The forces at work here are similar to those in {@link AbstractTestCollection}.
|
* The forces at work here are similar to those in {@link AbstractCollectionTest}.
|
||||||
* If your class implements the full Map interface, including optional
|
* If your class implements the full Map interface, including optional
|
||||||
* operations, simply extend this class, and implement the
|
* operations, simply extend this class, and implement the
|
||||||
* {@link #makeObject()} method.
|
* {@link #makeObject()} method.
|
||||||
|
@ -1778,18 +1778,18 @@ public abstract class AbstractTestMap<K, V> extends AbstractTestObject {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bulk test {@link Map#values()}. This method runs through all of
|
* Bulk test {@link Map#values()}. This method runs through all of
|
||||||
* the tests in {@link AbstractTestCollection}.
|
* the tests in {@link AbstractCollectionTest}.
|
||||||
* After modification operations, {@link #verify()} is invoked to ensure
|
* After modification operations, {@link #verify()} is invoked to ensure
|
||||||
* that the map and the other collection views are still valid.
|
* that the map and the other collection views are still valid.
|
||||||
*
|
*
|
||||||
* @return a {@link AbstractTestCollection} instance for testing the map's
|
* @return a {@link AbstractCollectionTest} instance for testing the map's
|
||||||
* values collection
|
* values collection
|
||||||
*/
|
*/
|
||||||
public BulkTest bulkTestMapValues() {
|
public BulkTest bulkTestMapValues() {
|
||||||
return new TestMapValues();
|
return new TestMapValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TestMapValues extends AbstractTestCollection<V> {
|
public class TestMapValues extends AbstractCollectionTest<V> {
|
||||||
public TestMapValues() {
|
public TestMapValues() {
|
||||||
super("");
|
super("");
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import java.util.Set;
|
||||||
import org.apache.commons.collections.IterableMap;
|
import org.apache.commons.collections.IterableMap;
|
||||||
import org.apache.commons.collections.Transformer;
|
import org.apache.commons.collections.Transformer;
|
||||||
import org.apache.commons.collections.TransformerUtils;
|
import org.apache.commons.collections.TransformerUtils;
|
||||||
import org.apache.commons.collections.collection.TestTransformedCollection;
|
import org.apache.commons.collections.collection.TransformedCollectionTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of {@link AbstractTestMap} for exercising the {@link TransformedMap}
|
* Extension of {@link AbstractTestMap} for exercising the {@link TransformedMap}
|
||||||
|
@ -55,7 +55,7 @@ public class TestTransformedMap<K, V> extends AbstractTestIterableMap<K, V> {
|
||||||
Map<K, V> map = TransformedMap
|
Map<K, V> map = TransformedMap
|
||||||
.transformingMap(
|
.transformingMap(
|
||||||
new HashMap<K, V>(),
|
new HashMap<K, V>(),
|
||||||
(Transformer<? super K, ? extends K>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER,
|
(Transformer<? super K, ? extends K>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER,
|
||||||
null);
|
null);
|
||||||
assertEquals(0, map.size());
|
assertEquals(0, map.size());
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
|
@ -70,7 +70,7 @@ public class TestTransformedMap<K, V> extends AbstractTestIterableMap<K, V> {
|
||||||
assertEquals(null, map.remove(els[0]));
|
assertEquals(null, map.remove(els[0]));
|
||||||
assertEquals(els[0], map.remove(new Integer((String) els[0])));
|
assertEquals(els[0], map.remove(new Integer((String) els[0])));
|
||||||
|
|
||||||
map = TransformedMap.transformingMap(new HashMap(), null, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
map = TransformedMap.transformingMap(new HashMap(), null, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
assertEquals(0, map.size());
|
assertEquals(0, map.size());
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
map.put((K) els[i], (V) els[i]);
|
map.put((K) els[i], (V) els[i]);
|
||||||
|
@ -107,7 +107,7 @@ public class TestTransformedMap<K, V> extends AbstractTestIterableMap<K, V> {
|
||||||
.transformingMap(
|
.transformingMap(
|
||||||
base,
|
base,
|
||||||
null,
|
null,
|
||||||
(Transformer<? super V, ? extends V>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
(Transformer<? super V, ? extends V>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
assertEquals(3, trans.size());
|
assertEquals(3, trans.size());
|
||||||
assertEquals("1", trans.get("A"));
|
assertEquals("1", trans.get("A"));
|
||||||
assertEquals("2", trans.get("B"));
|
assertEquals("2", trans.get("B"));
|
||||||
|
@ -127,7 +127,7 @@ public class TestTransformedMap<K, V> extends AbstractTestIterableMap<K, V> {
|
||||||
.transformedMap(
|
.transformedMap(
|
||||||
base,
|
base,
|
||||||
null,
|
null,
|
||||||
(Transformer<? super V, ? extends V>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
(Transformer<? super V, ? extends V>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
assertEquals(3, trans.size());
|
assertEquals(3, trans.size());
|
||||||
assertEquals(new Integer(1), trans.get("A"));
|
assertEquals(new Integer(1), trans.get("A"));
|
||||||
assertEquals(new Integer(2), trans.get("B"));
|
assertEquals(new Integer(2), trans.get("B"));
|
||||||
|
|
|
@ -26,7 +26,7 @@ import junit.framework.Test;
|
||||||
import org.apache.commons.collections.BulkTest;
|
import org.apache.commons.collections.BulkTest;
|
||||||
import org.apache.commons.collections.Transformer;
|
import org.apache.commons.collections.Transformer;
|
||||||
import org.apache.commons.collections.TransformerUtils;
|
import org.apache.commons.collections.TransformerUtils;
|
||||||
import org.apache.commons.collections.collection.TestTransformedCollection;
|
import org.apache.commons.collections.collection.TransformedCollectionTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of {@link AbstractTestSortedMap} for exercising the {@link TransformedSortedMap}
|
* Extension of {@link AbstractTestSortedMap} for exercising the {@link TransformedSortedMap}
|
||||||
|
@ -70,7 +70,7 @@ public class TestTransformedSortedMap<K, V> extends AbstractTestSortedMap<K, V>
|
||||||
SortedMap<K, V> map = TransformedSortedMap
|
SortedMap<K, V> map = TransformedSortedMap
|
||||||
.transformingSortedMap(
|
.transformingSortedMap(
|
||||||
new TreeMap<K, V>(),
|
new TreeMap<K, V>(),
|
||||||
(Transformer<? super K, ? extends K>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER,
|
(Transformer<? super K, ? extends K>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER,
|
||||||
null);
|
null);
|
||||||
assertEquals(0, map.size());
|
assertEquals(0, map.size());
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
|
@ -95,7 +95,7 @@ public class TestTransformedSortedMap<K, V> extends AbstractTestSortedMap<K, V>
|
||||||
.transformingSortedMap(
|
.transformingSortedMap(
|
||||||
new TreeMap<K, V>(),
|
new TreeMap<K, V>(),
|
||||||
null,
|
null,
|
||||||
(Transformer<? super V, ? extends V>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
(Transformer<? super V, ? extends V>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
assertEquals(0, map.size());
|
assertEquals(0, map.size());
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
map.put((K) els[i], (V) els[i]);
|
map.put((K) els[i], (V) els[i]);
|
||||||
|
@ -132,7 +132,7 @@ public class TestTransformedSortedMap<K, V> extends AbstractTestSortedMap<K, V>
|
||||||
.transformingSortedMap(
|
.transformingSortedMap(
|
||||||
base,
|
base,
|
||||||
null,
|
null,
|
||||||
(Transformer<? super V, ? extends V>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
(Transformer<? super V, ? extends V>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
assertEquals(3, trans.size());
|
assertEquals(3, trans.size());
|
||||||
assertEquals("1", trans.get("A"));
|
assertEquals("1", trans.get("A"));
|
||||||
assertEquals("2", trans.get("B"));
|
assertEquals("2", trans.get("B"));
|
||||||
|
@ -152,7 +152,7 @@ public class TestTransformedSortedMap<K, V> extends AbstractTestSortedMap<K, V>
|
||||||
.transformedSortedMap(
|
.transformedSortedMap(
|
||||||
base,
|
base,
|
||||||
null,
|
null,
|
||||||
(Transformer<? super V, ? extends V>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
(Transformer<? super V, ? extends V>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
assertEquals(3, trans.size());
|
assertEquals(3, trans.size());
|
||||||
assertEquals(new Integer(1), trans.get("A"));
|
assertEquals(new Integer(1), trans.get("A"));
|
||||||
assertEquals(new Integer(2), trans.get("B"));
|
assertEquals(new Integer(2), trans.get("B"));
|
||||||
|
|
|
@ -22,7 +22,7 @@ import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.collections.collection.AbstractTestCollection;
|
import org.apache.commons.collections.collection.AbstractCollectionTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract test class for {@link Set} methods and contracts.
|
* Abstract test class for {@link Set} methods and contracts.
|
||||||
|
@ -36,14 +36,14 @@ import org.apache.commons.collections.collection.AbstractTestCollection;
|
||||||
* To use, subclass and override the {@link #makeObject()}
|
* To use, subclass and override the {@link #makeObject()}
|
||||||
* method. You may have to override other protected methods if your
|
* method. You may have to override other protected methods if your
|
||||||
* set is not modifiable, or if your set restricts what kinds of
|
* set is not modifiable, or if your set restricts what kinds of
|
||||||
* elements may be added; see {@link AbstractTestCollection} for more details.
|
* elements may be added; see {@link AbstractCollectionTest} for more details.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since Commons Collections 3.0
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*
|
*
|
||||||
* @author Paul Jack
|
* @author Paul Jack
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractTestSet<E> extends AbstractTestCollection<E> {
|
public abstract class AbstractTestSet<E> extends AbstractCollectionTest<E> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JUnit constructor.
|
* JUnit constructor.
|
||||||
|
@ -128,7 +128,7 @@ public abstract class AbstractTestSet<E> extends AbstractTestCollection<E> {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* Return the {@link AbstractTestCollection#collection} fixture, but cast as a Set.
|
* Return the {@link AbstractCollectionTest#collection} fixture, but cast as a Set.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<E> getCollection() {
|
public Set<E> getCollection() {
|
||||||
|
@ -136,7 +136,7 @@ public abstract class AbstractTestSet<E> extends AbstractTestCollection<E> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the {@link AbstractTestCollection#confirmed} fixture, but cast as a Set.
|
* Return the {@link AbstractCollectionTest#confirmed} fixture, but cast as a Set.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<E> getConfirmed() {
|
public Set<E> getConfirmed() {
|
||||||
|
|
|
@ -21,7 +21,7 @@ import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.collections.Transformer;
|
import org.apache.commons.collections.Transformer;
|
||||||
import org.apache.commons.collections.collection.TestTransformedCollection;
|
import org.apache.commons.collections.collection.TransformedCollectionTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of {@link AbstractTestSet} for exercising the {@link TransformedSet}
|
* Extension of {@link AbstractTestSet} for exercising the {@link TransformedSet}
|
||||||
|
@ -54,7 +54,7 @@ public class TestTransformedSet<E> extends AbstractTestSet<E> {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Set<E> makeObject() {
|
public Set<E> makeObject() {
|
||||||
return TransformedSet.transformingSet(new HashSet<E>(),
|
return TransformedSet.transformingSet(new HashSet<E>(),
|
||||||
(Transformer<E, E>) TestTransformedCollection.NOOP_TRANSFORMER);
|
(Transformer<E, E>) TransformedCollectionTest.NOOP_TRANSFORMER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -63,13 +63,13 @@ public class TestTransformedSet<E> extends AbstractTestSet<E> {
|
||||||
Set<E> list = new HashSet<E>();
|
Set<E> list = new HashSet<E>();
|
||||||
list.addAll(Arrays.asList(getFullElements()));
|
list.addAll(Arrays.asList(getFullElements()));
|
||||||
return TransformedSet.transformingSet(list,
|
return TransformedSet.transformingSet(list,
|
||||||
(Transformer<E, E>) TestTransformedCollection.NOOP_TRANSFORMER);
|
(Transformer<E, E>) TransformedCollectionTest.NOOP_TRANSFORMER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void testTransformedSet() {
|
public void testTransformedSet() {
|
||||||
Set<E> set = TransformedSet.transformingSet(new HashSet<E>(),
|
Set<E> set = TransformedSet.transformingSet(new HashSet<E>(),
|
||||||
(Transformer<E, E>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
(Transformer<E, E>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
assertEquals(0, set.size());
|
assertEquals(0, set.size());
|
||||||
E[] els = (E[]) new Object[] { "1", "3", "5", "7", "2", "4", "6" };
|
E[] els = (E[]) new Object[] { "1", "3", "5", "7", "2", "4", "6" };
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
|
@ -90,7 +90,7 @@ public class TestTransformedSet<E> extends AbstractTestSet<E> {
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
originalSet.add(els[i]);
|
originalSet.add(els[i]);
|
||||||
}
|
}
|
||||||
Set<?> set = TransformedSet.transformedSet(originalSet, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
Set<?> set = TransformedSet.transformedSet(originalSet, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
assertEquals(els.length, set.size());
|
assertEquals(els.length, set.size());
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
assertEquals(true, set.contains(new Integer((String) els[i])));
|
assertEquals(true, set.contains(new Integer((String) els[i])));
|
||||||
|
|
|
@ -25,7 +25,7 @@ import junit.framework.Test;
|
||||||
|
|
||||||
import org.apache.commons.collections.BulkTest;
|
import org.apache.commons.collections.BulkTest;
|
||||||
import org.apache.commons.collections.Transformer;
|
import org.apache.commons.collections.Transformer;
|
||||||
import org.apache.commons.collections.collection.TestTransformedCollection;
|
import org.apache.commons.collections.collection.TransformedCollectionTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of {@link AbstractTestSortedSet} for exercising the {@link TransformedSortedSet}
|
* Extension of {@link AbstractTestSortedSet} for exercising the {@link TransformedSortedSet}
|
||||||
|
@ -50,7 +50,7 @@ public class TestTransformedSortedSet<E> extends AbstractTestSortedSet<E> {
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public SortedSet<E> makeObject() {
|
public SortedSet<E> makeObject() {
|
||||||
return TransformedSortedSet.transformingSortedSet(new TreeSet<E>(), (Transformer<E, E>) TestTransformedCollection.NOOP_TRANSFORMER);
|
return TransformedSortedSet.transformingSortedSet(new TreeSet<E>(), (Transformer<E, E>) TransformedCollectionTest.NOOP_TRANSFORMER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -58,14 +58,14 @@ public class TestTransformedSortedSet<E> extends AbstractTestSortedSet<E> {
|
||||||
public SortedSet<E> makeFullCollection() {
|
public SortedSet<E> makeFullCollection() {
|
||||||
SortedSet<E> set = new TreeSet<E>();
|
SortedSet<E> set = new TreeSet<E>();
|
||||||
set.addAll(Arrays.asList(getFullElements()));
|
set.addAll(Arrays.asList(getFullElements()));
|
||||||
return TransformedSortedSet.transformingSortedSet(set, (Transformer<E, E>) TestTransformedCollection.NOOP_TRANSFORMER);
|
return TransformedSortedSet.transformingSortedSet(set, (Transformer<E, E>) TransformedCollectionTest.NOOP_TRANSFORMER);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void testTransformedSet() {
|
public void testTransformedSet() {
|
||||||
SortedSet<E> set = TransformedSortedSet.transformingSortedSet(new TreeSet<E>(),
|
SortedSet<E> set = TransformedSortedSet.transformingSortedSet(new TreeSet<E>(),
|
||||||
(Transformer<E, E>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
(Transformer<E, E>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
assertEquals(0, set.size());
|
assertEquals(0, set.size());
|
||||||
E[] els = (E[]) new Object[] { "1", "3", "5", "7", "2", "4", "6" };
|
E[] els = (E[]) new Object[] { "1", "3", "5", "7", "2", "4", "6" };
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
|
@ -83,7 +83,7 @@ public class TestTransformedSortedSet<E> extends AbstractTestSortedSet<E> {
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
originalSet.add(els[i]);
|
originalSet.add(els[i]);
|
||||||
}
|
}
|
||||||
Set<?> set = TransformedSortedSet.transformedSet(originalSet, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
|
Set<?> set = TransformedSortedSet.transformedSet(originalSet, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||||
assertEquals(els.length, set.size());
|
assertEquals(els.length, set.size());
|
||||||
for (int i = 0; i < els.length; i++) {
|
for (int i = 0; i < els.length; i++) {
|
||||||
assertEquals(true, set.contains(new Integer((String) els[i])));
|
assertEquals(true, set.contains(new Integer((String) els[i])));
|
||||||
|
|
Loading…
Reference in New Issue