Renamed unit tests for set package.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1374067 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Neidhart 2012-08-16 21:25:00 +00:00
parent 056d81fe40
commit dcb64284ef
18 changed files with 109 additions and 144 deletions

View File

@ -105,7 +105,7 @@ import org.apache.commons.collections.AbstractTestObject;
* that's compatible with your collection implementation.
* <p>
* If you're extending {@link org.apache.commons.collections.list.AbstractListTest AbstractListTest},
* {@link org.apache.commons.collections.set.AbstractTestSet AbstractTestSet},
* {@link org.apache.commons.collections.set.AbstractSetTest AbstractTestSet},
* or {@link org.apache.commons.collections.bag.AbstractBagTest AbstractBagTest},
* you probably don't have to worry about the
* above methods, because those three classes already override the methods

View File

@ -34,7 +34,7 @@ import org.apache.commons.collections.BulkTest;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.collection.AbstractCollectionTest;
import org.apache.commons.collections.keyvalue.DefaultMapEntry;
import org.apache.commons.collections.set.AbstractTestSet;
import org.apache.commons.collections.set.AbstractSetTest;
/**
* Abstract test class for {@link java.util.Map} methods and contracts.
@ -106,7 +106,7 @@ import org.apache.commons.collections.set.AbstractTestSet;
* {@link #verify} method calls separate methods to verify the map and its three
* collection views ({@link #verifyMap}, {@link #verifyEntrySet},
* {@link #verifyKeySet}, and {@link #verifyValues}). You may want to override
* one of the verification methodsto perform additional verifications. For
* one of the verification methods to perform additional verifications. For
* instance, TestDoubleOrderedMap would want override its
* {@link #verifyValues()} method to verify that the values are unique and in
* ascending order.<P>
@ -1510,17 +1510,17 @@ public abstract class AbstractTestMap<K, V> extends AbstractTestObject {
/**
* Bulk test {@link Map#entrySet()}. This method runs through all of
* the tests in {@link AbstractTestSet}.
* the tests in {@link AbstractSetTest}.
* After modification operations, {@link #verify()} is invoked to ensure
* that the map and the other collection views are still valid.
*
* @return a {@link AbstractTestSet} instance for testing the map's entry set
* @return a {@link AbstractSetTest} instance for testing the map's entry set
*/
public BulkTest bulkTestMapEntrySet() {
return new TestMapEntrySet();
}
public class TestMapEntrySet extends AbstractTestSet<Map.Entry<K, V>> {
public class TestMapEntrySet extends AbstractSetTest<Map.Entry<K, V>> {
public TestMapEntrySet() {
super("MapEntrySet");
}
@ -1700,17 +1700,17 @@ public abstract class AbstractTestMap<K, V> extends AbstractTestObject {
/**
* Bulk test {@link Map#keySet()}. This method runs through all of
* the tests in {@link AbstractTestSet}.
* the tests in {@link AbstractSetTest}.
* After modification operations, {@link #verify()} is invoked to ensure
* that the map and the other collection views are still valid.
*
* @return a {@link AbstractTestSet} instance for testing the map's key set
* @return a {@link AbstractSetTest} instance for testing the map's key set
*/
public BulkTest bulkTestMapKeySet() {
return new TestMapKeySet();
}
public class TestMapKeySet extends AbstractTestSet<K> {
public class TestMapKeySet extends AbstractSetTest<K> {
public TestMapKeySet() {
super("");
}

View File

@ -38,19 +38,17 @@ import org.apache.commons.collections.collection.AbstractCollectionTest;
* set is not modifiable, or if your set restricts what kinds of
* elements may be added; see {@link AbstractCollectionTest} for more details.
*
* @since Commons Collections 3.0
* @version $Revision$
*
* @author Paul Jack
* @since 3.0
* @version $Id$
*/
public abstract class AbstractTestSet<E> extends AbstractCollectionTest<E> {
public abstract class AbstractSetTest<E> extends AbstractCollectionTest<E> {
/**
* JUnit constructor.
*
* @param name name for test
*/
public AbstractTestSet(String name) {
public AbstractSetTest(String name) {
super(name);
}

View File

@ -28,22 +28,19 @@ import org.apache.commons.collections.BulkTest;
* To use, subclass and override the {@link #makeObject()}
* method. You may have to override other protected methods if your
* set is not modifiable, or if your set restricts what kinds of
* elements may be added; see {@link AbstractTestSet} for more details.
* elements may be added; see {@link AbstractSetTest} for more details.
*
* @since Commons Collections 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @author Dieter Wimberger
* @since 3.0
* @version $Id$
*/
public abstract class AbstractTestSortedSet<E> extends AbstractTestSet<E> {
public abstract class AbstractSortedSetTest<E> extends AbstractSetTest<E> {
/**
* JUnit constructor.
*
* @param name name for test
*/
public AbstractTestSortedSet(String name) {
public AbstractSortedSetTest(String name) {
super(name);
}
@ -147,11 +144,11 @@ public abstract class AbstractTestSortedSet<E> extends AbstractTestSet<E> {
//-----------------------------------------------------------------------
/**
* Bulk test {@link SortedSet#subSet(Object, Object)}. This method runs through all of
* the tests in {@link AbstractTestSortedSet}.
* the tests in {@link AbstractSortedSetTest}.
* After modification operations, {@link #verify()} is invoked to ensure
* that the set and the other collection views are still valid.
*
* @return a {@link AbstractTestSet} instance for testing a subset.
* @return a {@link AbstractSetTest} instance for testing a subset.
*/
public BulkTest bulkTestSortedSetSubSet() {
int length = getFullElements().length;
@ -164,11 +161,11 @@ public abstract class AbstractTestSortedSet<E> extends AbstractTestSet<E> {
/**
* Bulk test {@link SortedSet#headSet(Object)}. This method runs through all of
* the tests in {@link AbstractTestSortedSet}.
* the tests in {@link AbstractSortedSetTest}.
* After modification operations, {@link #verify()} is invoked to ensure
* that the set and the other collection views are still valid.
*
* @return a {@link AbstractTestSet} instance for testing a headset.
* @return a {@link AbstractSetTest} instance for testing a headset.
*/
public BulkTest bulkTestSortedSetHeadSet() {
int length = getFullElements().length;
@ -181,11 +178,11 @@ public abstract class AbstractTestSortedSet<E> extends AbstractTestSet<E> {
/**
* Bulk test {@link SortedSet#tailSet(Object)}. This method runs through all of
* the tests in {@link AbstractTestSortedSet}.
* the tests in {@link AbstractSortedSetTest}.
* After modification operations, {@link #verify()} is invoked to ensure
* that the set and the other collection views are still valid.
*
* @return a {@link AbstractTestSet} instance for testing a tailset.
* @return a {@link AbstractSetTest} instance for testing a tailset.
*/
public BulkTest bulkTestSortedSetTailSet() {
int length = getFullElements().length;
@ -193,7 +190,7 @@ public abstract class AbstractTestSortedSet<E> extends AbstractTestSet<E> {
return new TestSortedSetSubSet(lobound, false);
}
public class TestSortedSetSubSet extends AbstractTestSortedSet<E> {
public class TestSortedSetSubSet extends AbstractSortedSetTest<E> {
private int m_Type;
private int m_LowBound;
@ -209,23 +206,23 @@ public abstract class AbstractTestSortedSet<E> extends AbstractTestSet<E> {
m_Type = TYPE_HEADSET;
m_HighBound = bound;
m_FullElements = (E[]) new Object[bound];
System.arraycopy(AbstractTestSortedSet.this.getFullElements(), 0, m_FullElements, 0, bound);
System.arraycopy(AbstractSortedSetTest.this.getFullElements(), 0, m_FullElements, 0, bound);
m_OtherElements = (E[]) new Object[bound - 1];
System.arraycopy(//src src_pos dst dst_pos length
AbstractTestSortedSet.this.getOtherElements(), 0, m_OtherElements, 0, bound - 1);
AbstractSortedSetTest.this.getOtherElements(), 0, m_OtherElements, 0, bound - 1);
//System.out.println(new TreeSet(Arrays.asList(m_FullElements)));
//System.out.println(new TreeSet(Arrays.asList(m_OtherElements)));
} else {
//System.out.println("TAILSET");
m_Type = TYPE_TAILSET;
m_LowBound = bound;
Object[] allelements = AbstractTestSortedSet.this.getFullElements();
Object[] allelements = AbstractSortedSetTest.this.getFullElements();
//System.out.println("bound = "+bound +"::length="+allelements.length);
m_FullElements = (E[]) new Object[allelements.length - bound];
System.arraycopy(allelements, bound, m_FullElements, 0, allelements.length - bound);
m_OtherElements = (E[]) new Object[allelements.length - bound - 1];
System.arraycopy(//src src_pos dst dst_pos length
AbstractTestSortedSet.this.getOtherElements(), bound, m_OtherElements, 0, allelements.length - bound - 1);
AbstractSortedSetTest.this.getOtherElements(), bound, m_OtherElements, 0, allelements.length - bound - 1);
//System.out.println(new TreeSet(Arrays.asList(m_FullElements)));
//System.out.println(new TreeSet(Arrays.asList(m_OtherElements)));
//resetFull();
@ -246,10 +243,10 @@ public abstract class AbstractTestSortedSet<E> extends AbstractTestSet<E> {
int length = hibound - lobound;
//System.out.println("Low=" + lobound + "::High=" + hibound + "::Length=" + length);
m_FullElements = (E[]) new Object[length];
System.arraycopy(AbstractTestSortedSet.this.getFullElements(), lobound, m_FullElements, 0, length);
System.arraycopy(AbstractSortedSetTest.this.getFullElements(), lobound, m_FullElements, 0, length);
m_OtherElements = (E[]) new Object[length - 1];
System.arraycopy(//src src_pos dst dst_pos length
AbstractTestSortedSet.this.getOtherElements(), lobound, m_OtherElements, 0, length - 1);
AbstractSortedSetTest.this.getOtherElements(), lobound, m_OtherElements, 0, length - 1);
//System.out.println(new TreeSet(Arrays.asList(m_FullElements)));
//System.out.println(new TreeSet(Arrays.asList(m_OtherElements)));
@ -258,19 +255,19 @@ public abstract class AbstractTestSortedSet<E> extends AbstractTestSet<E> {
@Override
public boolean isNullSupported() {
return AbstractTestSortedSet.this.isNullSupported();
return AbstractSortedSetTest.this.isNullSupported();
}
@Override
public boolean isAddSupported() {
return AbstractTestSortedSet.this.isAddSupported();
return AbstractSortedSetTest.this.isAddSupported();
}
@Override
public boolean isRemoveSupported() {
return AbstractTestSortedSet.this.isRemoveSupported();
return AbstractSortedSetTest.this.isRemoveSupported();
}
@Override
public boolean isFailFastSupported() {
return AbstractTestSortedSet.this.isFailFastSupported();
return AbstractSortedSetTest.this.isFailFastSupported();
}
@Override
@ -283,7 +280,7 @@ public abstract class AbstractTestSortedSet<E> extends AbstractTestSet<E> {
}
private SortedSet<E> getSubSet(SortedSet<E> set) {
E[] elements = AbstractTestSortedSet.this.getFullElements();
E[] elements = AbstractSortedSetTest.this.getFullElements();
switch (m_Type) {
case TYPE_SUBSET :
return set.subSet(elements[m_LowBound], elements[m_HighBound]);
@ -298,12 +295,12 @@ public abstract class AbstractTestSortedSet<E> extends AbstractTestSet<E> {
@Override
public SortedSet<E> makeObject() {
return getSubSet(AbstractTestSortedSet.this.makeObject());
return getSubSet(AbstractSortedSetTest.this.makeObject());
}
@Override
public SortedSet<E> makeFullCollection() {
return getSubSet(AbstractTestSortedSet.this.makeFullCollection());
return getSubSet(AbstractSortedSetTest.this.makeFullCollection());
}
@Override

View File

@ -24,18 +24,14 @@ import java.util.Set;
import org.apache.commons.collections.collection.CompositeCollection;
/**
* Extension of {@link AbstractTestSet} for exercising the
* Extension of {@link AbstractSetTest} for exercising the
* {@link CompositeSet} implementation.
*
* @since Commons Collections 3.0
* @version $Revision$
*
* @author Brian McCallister
* @author Phil Steitz
* @since 3.0
* @version $Id$
*/
public class TestCompositeSet<E> extends AbstractTestSet<E> {
public TestCompositeSet(String name) {
public class CompositeSetTest<E> extends AbstractSetTest<E> {
public CompositeSetTest(String name) {
super(name);
}

View File

@ -23,8 +23,8 @@ import java.util.Set;
import org.apache.commons.collections.collection.CompositeCollection;
/**
* This class is used in TestCompositeSet. When testing serialization,
* the class has to be separate of TestCompositeSet, else the test
* This class is used in CompositeSetTest. When testing serialization,
* the class has to be separate of CompositeSetTest, else the test
* class also has to be serialized.
*/
class EmptySetMutator<E> implements CompositeSet.SetMutator<E> {

View File

@ -21,23 +21,20 @@ import java.util.Iterator;
import java.util.List;
/**
* Extension of {@link AbstractTestSet} for exercising the {@link ListOrderedSet}
* Extension of {@link AbstractSetTest} for exercising the {@link ListOrderedSet}
* implementation.
*
* @since Commons Collections 3.1
* @version $Revision$
*
* @author Henning P. Schmiedehausen
* @author Stephen Colebourne
* @since 3.1
* @version $Id$
*/
public class TestListOrderedSet2<E> extends AbstractTestSet<E> {
public class ListOrderedSet2Test<E> extends AbstractSetTest<E> {
private static final Integer ZERO = new Integer(0);
private static final Integer ONE = new Integer(1);
private static final Integer TWO = new Integer(2);
private static final Integer THREE = new Integer(3);
public TestListOrderedSet2(String testName) {
public ListOrderedSet2Test(String testName) {
super(testName);
}

View File

@ -23,23 +23,20 @@ import java.util.List;
import java.util.Set;
/**
* Extension of {@link AbstractTestSet} for exercising the {@link ListOrderedSet}
* Extension of {@link AbstractSetTest} for exercising the {@link ListOrderedSet}
* implementation.
*
* @since Commons Collections 3.0
* @version $Revision$
*
* @author Henning P. Schmiedehausen
* @author Stephen Colebourne
* @since 3.0
* @version $Id$
*/
public class TestListOrderedSet<E> extends AbstractTestSet<E> {
public class ListOrderedSetTest<E> extends AbstractSetTest<E> {
private static final Integer ZERO = new Integer(0);
private static final Integer ONE = new Integer(1);
private static final Integer TWO = new Integer(2);
private static final Integer THREE = new Integer(3);
public TestListOrderedSet(String testName) {
public ListOrderedSetTest(String testName) {
super(testName);
}

View File

@ -24,14 +24,12 @@ import org.apache.commons.collections.map.LinkedMap;
/**
* JUnit test.
*
* @since Commons Collections 3.1
* @version $Revision$
*
* @author Stephen Colebourne
* @since 3.1
* @version $Id$
*/
public class TestMapBackedSet2<E> extends AbstractTestSet<E> {
public class MapBackedSet2Test<E> extends AbstractSetTest<E> {
public TestMapBackedSet2(String testName) {
public MapBackedSet2Test(String testName) {
super(testName);
}

View File

@ -23,14 +23,12 @@ import org.apache.commons.collections.map.HashedMap;
/**
* JUnit test.
*
* @since Commons Collections 3.1
* @version $Revision$
*
* @author Stephen Colebourne
* @since 3.1
* @version $Id$
*/
public class TestMapBackedSet<E> extends AbstractTestSet<E> {
public class MapBackedSetTest<E> extends AbstractSetTest<E> {
public TestMapBackedSet(String testName) {
public MapBackedSetTest(String testName) {
super(testName);
}

View File

@ -23,17 +23,15 @@ import org.apache.commons.collections.Predicate;
import org.apache.commons.collections.functors.TruePredicate;
/**
* Extension of {@link AbstractTestSet} for exercising the
* Extension of {@link AbstractSetTest} for exercising the
* {@link PredicatedSet} implementation.
*
* @since Commons Collections 3.0
* @version $Revision$
*
* @author Phil Steitz
* @since 3.0
* @version $Id$
*/
public class TestPredicatedSet<E> extends AbstractTestSet<E> {
public class PredicatedSetTest<E> extends AbstractSetTest<E> {
public TestPredicatedSet(String testName) {
public PredicatedSetTest(String testName) {
super(testName);
}

View File

@ -29,22 +29,20 @@ import org.apache.commons.collections.Predicate;
import org.apache.commons.collections.functors.TruePredicate;
/**
* Extension of {@link AbstractTestSortedSet} for exercising the
* Extension of {@link AbstractSortedSetTest} for exercising the
* {@link PredicatedSortedSet} implementation.
*
* @since Commons Collections 3.0
* @version $Revision$
*
* @author Phil Steitz
* @since 3.0
* @version $Id$
*/
public class TestPredicatedSortedSet<E> extends AbstractTestSortedSet<E> {
public class PredicatedSortedSetTest<E> extends AbstractSortedSetTest<E> {
public TestPredicatedSortedSet(String testName) {
public PredicatedSortedSetTest(String testName) {
super(testName);
}
public static Test suite() {
return BulkTest.makeSuite(TestPredicatedSortedSet.class);
return BulkTest.makeSuite(PredicatedSortedSetTest.class);
}
//-------------------------------------------------------------------

View File

@ -24,22 +24,20 @@ import junit.framework.Test;
import org.apache.commons.collections.BulkTest;
/**
* Extension of {@link AbstractTestSet} for exercising the
* Extension of {@link AbstractSetTest} for exercising the
* {@link SynchronizedSet} implementation.
*
* @since Commons Collections 3.1
* @version $Revision$
*
* @author Stephen Colebourne
* @since 3.1
* @version $Id$
*/
public class TestSynchronizedSet<E> extends AbstractTestSet<E> {
public class SynchronizedSetTest<E> extends AbstractSetTest<E> {
public TestSynchronizedSet(String testName) {
public SynchronizedSetTest(String testName) {
super(testName);
}
public static Test suite() {
return BulkTest.makeSuite(TestSynchronizedSet.class);
return BulkTest.makeSuite(SynchronizedSetTest.class);
}
//-------------------------------------------------------------------

View File

@ -24,22 +24,20 @@ import junit.framework.Test;
import org.apache.commons.collections.BulkTest;
/**
* Extension of {@link AbstractTestSet} for exercising the
* Extension of {@link AbstractSetTest} for exercising the
* {@link SynchronizedSortedSet} implementation.
*
* @since Commons Collections 3.1
* @version $Revision$
*
* @author Stephen Colebourne
* @since 3.1
* @version $Id$
*/
public class TestSynchronizedSortedSet<E> extends AbstractTestSortedSet<E> {
public class SynchronizedSortedSetTest<E> extends AbstractSortedSetTest<E> {
public TestSynchronizedSortedSet(String testName) {
public SynchronizedSortedSetTest(String testName) {
super(testName);
}
public static Test suite() {
return BulkTest.makeSuite(TestSynchronizedSortedSet.class);
return BulkTest.makeSuite(SynchronizedSortedSetTest.class);
}
//-------------------------------------------------------------------

View File

@ -24,17 +24,15 @@ import org.apache.commons.collections.Transformer;
import org.apache.commons.collections.collection.TransformedCollectionTest;
/**
* Extension of {@link AbstractTestSet} for exercising the {@link TransformedSet}
* Extension of {@link AbstractSetTest} for exercising the {@link TransformedSet}
* implementation.
*
* @since Commons Collections 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @since 3.0
* @version $Id$
*/
public class TestTransformedSet<E> extends AbstractTestSet<E> {
public class TransformedSetTest<E> extends AbstractSetTest<E> {
public TestTransformedSet(String testName) {
public TransformedSetTest(String testName) {
super(testName);
}

View File

@ -28,22 +28,20 @@ import org.apache.commons.collections.Transformer;
import org.apache.commons.collections.collection.TransformedCollectionTest;
/**
* Extension of {@link AbstractTestSortedSet} for exercising the {@link TransformedSortedSet}
* Extension of {@link AbstractSortedSetTest} for exercising the {@link TransformedSortedSet}
* implementation.
*
* @since Commons Collections 3.0
* @version $Revision$
*
* @author Stephen Colebourne
* @since 3.0
* @version $Id$
*/
public class TestTransformedSortedSet<E> extends AbstractTestSortedSet<E> {
public class TransformedSortedSetTest<E> extends AbstractSortedSetTest<E> {
public TestTransformedSortedSet(String testName) {
public TransformedSortedSetTest(String testName) {
super(testName);
}
public static Test suite() {
return BulkTest.makeSuite(TestTransformedSortedSet.class);
return BulkTest.makeSuite(TransformedSortedSetTest.class);
}
//-----------------------------------------------------------------------

View File

@ -25,22 +25,20 @@ import junit.framework.Test;
import org.apache.commons.collections.BulkTest;
/**
* Extension of {@link AbstractTestSet} for exercising the
* Extension of {@link AbstractSetTest} for exercising the
* {@link UnmodifiableSet} implementation.
*
* @since Commons Collections 3.0
* @version $Revision$
*
* @author Phil Steitz
* @since 3.0
* @version $Id$
*/
public class TestUnmodifiableSet<E> extends AbstractTestSet<E> {
public class UnmodifiableSetTest<E> extends AbstractSetTest<E> {
public TestUnmodifiableSet(String testName) {
public UnmodifiableSetTest(String testName) {
super(testName);
}
public static Test suite() {
return BulkTest.makeSuite(TestUnmodifiableSet.class);
return BulkTest.makeSuite(UnmodifiableSetTest.class);
}
//-------------------------------------------------------------------

View File

@ -28,24 +28,22 @@ import junit.framework.Test;
import org.apache.commons.collections.BulkTest;
/**
* Extension of {@link AbstractTestSortedSet} for exercising the
* Extension of {@link AbstractSortedSetTest} for exercising the
* {@link UnmodifiableSortedSet} implementation.
*
* @since Commons Collections 3.0
* @version $Revision$
*
* @author Phil Steitz
* @since 3.0
* @version $Id$
*/
public class TestUnmodifiableSortedSet<E> extends AbstractTestSortedSet<E> {
public class UnmodifiableSortedSetTest<E> extends AbstractSortedSetTest<E> {
protected UnmodifiableSortedSet<E> set = null;
protected ArrayList<E> array = null;
public TestUnmodifiableSortedSet(String testName) {
public UnmodifiableSortedSetTest(String testName) {
super(testName);
}
public static Test suite() {
return BulkTest.makeSuite(TestUnmodifiableSortedSet.class);
return BulkTest.makeSuite(UnmodifiableSortedSetTest.class);
}
//-------------------------------------------------------------------