[COLLECTIONS-777] Migrate to JUnit 5

Remove JUnit 3 constructors
This commit is contained in:
Gary Gregory 2024-11-11 08:50:52 -05:00
parent d2d894e3c4
commit aa13ed385b
169 changed files with 18 additions and 896 deletions

View File

@ -30,10 +30,6 @@ import org.junit.jupiter.api.Test;
*/
public abstract class AbstractArrayListTest<E> extends AbstractListTest<E> {
public AbstractArrayListTest(final String testName) {
super(testName);
}
/**
* {@inheritDoc}
*/

View File

@ -40,10 +40,6 @@ import org.junit.jupiter.api.Test;
*/
public abstract class AbstractLinkedListTest<T> extends AbstractListTest<T> {
public AbstractLinkedListTest(final String testName) {
super(testName);
}
/**
* Returns the {@link #collection} field cast to a {@link LinkedList}.
*

View File

@ -49,15 +49,6 @@ public abstract class AbstractObjectTest extends BulkTest {
/** Current major release for Collections */
public static final int COLLECTIONS_MAJOR_VERSION = 4;
/**
* JUnit constructor.
*
* @param testName the test class name
*/
public AbstractObjectTest(final String testName) {
super(testName);
}
protected String getCanonicalEmptyCollectionName(final Object object) {
final StringBuilder retval = new StringBuilder();
retval.append(TEST_DATA_PATH);

View File

@ -32,10 +32,6 @@ import org.junit.jupiter.api.Test;
*/
public abstract class AbstractTreeMapTest<K, V> extends AbstractMapTest<TreeMap<K, V>, K, V> {
public AbstractTreeMapTest(final String testName) {
super(testName);
}
@Override
public boolean isAllowNullKey() {
return false;

View File

@ -31,10 +31,6 @@ import org.junit.jupiter.api.Test;
@SuppressWarnings("deprecation") // we test a deprecated class
public class ArrayStackTest<E> extends AbstractArrayListTest<E> {
public ArrayStackTest() {
super(ArrayStackTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {
return "4";

View File

@ -16,21 +16,18 @@
*/
package org.apache.commons.collections4;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* A {@link TestCase} that can define both simple and bulk test methods.
* A {@code TestCase} that can define both simple and bulk test methods.
* <p>
* A <em>simple test method</em> is the type of test traditionally
* supplied by {@link TestCase}. To define a simple test, create a public
* supplied by {@code TestCase}. To define a simple test, create a public
* no-argument method whose name starts with "test". You can specify
* the name of simple test in the constructor of {@code BulkTest};
* a subsequent call to {@link TestCase#run} will run that simple test.
* a subsequent call to {@code TestCase#run} will run that simple test.
* <p>
* A <em>bulk test method</em>, on the other hand, returns a new instance
* of {@code BulkTest}, which can itself define new simple and bulk
* test methods. By using the {@link #makeSuite} method, you can
* test methods. By using the {@code #makeSuite} method, you can
* automatically create a hierarchical suite of tests and child bulk tests.
* <p>
* For instance, consider the following two classes:
@ -121,11 +118,11 @@ import junit.framework.TestSuite;
* A subclass can override a superclass's bulk test by
* returning {@code null} from the bulk test method. If you only
* want to override specific simple tests within a bulk test, use the
* {@link #ignoredTests} method.<P>
* {@code #ignoredTests} method.<P>
*
* Note that if you want to use the bulk test methods, you <em>must</em>
* define your {@code suite()} method to use {@link #makeSuite}.
* The ordinary {@link TestSuite} constructor doesn't know how to
* define your {@code suite()} method to use {@code #makeSuite}.
* The ordinary {@code TestSuite} constructor doesn't know how to
* interpret bulk test methods.
*/
public class BulkTest implements Cloneable {
@ -160,11 +157,9 @@ public class BulkTest implements Cloneable {
/**
* Constructs a new {@code BulkTest} instance that will run the
* specified simple test.
*
* @param name the name of the simple test method to run
*/
public BulkTest(final String name) {
this.name = name;
public BulkTest() {
this.name = getClass().getSimpleName();
this.verboseName = getClass().getName();
}

View File

@ -39,7 +39,6 @@ import org.apache.commons.collections4.BulkTest;
import org.apache.commons.collections4.collection.AbstractCollectionTest;
import org.apache.commons.collections4.set.AbstractSetTest;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.Test;
/**
@ -71,10 +70,6 @@ public abstract class AbstractBagTest<T> extends AbstractCollectionTest<T> {
public class TestBagUniqueSet extends AbstractSetTest<T> {
public TestBagUniqueSet() {
super(StringUtils.EMPTY);
}
@Override
public T[] getFullElements() {
return AbstractBagTest.this.getFullElements();
@ -142,11 +137,8 @@ public abstract class AbstractBagTest<T> extends AbstractCollectionTest<T> {
/**
* JUnit constructor.
*
* @param testName the test class name
*/
public AbstractBagTest(final String testName) {
super(testName);
public AbstractBagTest() {
}
/**

View File

@ -29,10 +29,6 @@ import org.apache.commons.collections4.SortedBag;
*/
public abstract class AbstractSortedBagTest<T> extends AbstractBagTest<T> {
public AbstractSortedBagTest(final String testName) {
super(testName);
}
/**
* Returns the {@link #collection} field cast to a {@link SortedBag}.
*

View File

@ -41,13 +41,6 @@ import org.junit.jupiter.api.Test;
*/
public class CollectionBagTest<T> extends AbstractCollectionTest<T> {
/**
* JUnit constructor.
*/
public CollectionBagTest() {
super(CollectionBagTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {
return "4";

View File

@ -37,13 +37,6 @@ import org.junit.jupiter.api.Test;
*/
public class CollectionSortedBagTest<T> extends AbstractCollectionTest<T> {
/**
* JUnit constructor.
*/
public CollectionSortedBagTest() {
super(CollectionSortedBagTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {
return "4";

View File

@ -24,10 +24,6 @@ import org.apache.commons.collections4.Bag;
*/
public class HashBagTest<T> extends AbstractBagTest<T> {
public HashBagTest() {
super(HashBagTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {
return "4";

View File

@ -36,10 +36,6 @@ public class PredicatedBagTest<T> extends AbstractBagTest<T> {
protected Predicate<T> truePredicate = TruePredicate.<T>truePredicate();
public PredicatedBagTest() {
super(PredicatedBagTest.class.getSimpleName());
}
protected Bag<T> decorateBag(final HashBag<T> bag, final Predicate<T> predicate) {
return PredicatedBag.predicatedBag(bag, predicate);
}

View File

@ -37,10 +37,6 @@ public class PredicatedSortedBagTest<T> extends AbstractSortedBagTest<T> {
protected Predicate<T> truePredicate = TruePredicate.<T>truePredicate();
public PredicatedSortedBagTest() {
super(PredicatedSortedBagTest.class.getSimpleName());
}
protected SortedBag<T> decorateBag(final SortedBag<T> bag, final Predicate<T> predicate) {
return PredicatedSortedBag.predicatedSortedBag(bag, predicate);
}

View File

@ -23,10 +23,6 @@ import org.apache.commons.collections4.Bag;
*/
public class SynchronizedBagTest<T> extends AbstractBagTest<T> {
public SynchronizedBagTest() {
super(SynchronizedBagTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {
return "4";

View File

@ -31,10 +31,6 @@ import org.junit.jupiter.api.Test;
*/
public class TransformedBagTest<T> extends AbstractBagTest<T> {
public TransformedBagTest() {
super(TransformedBagTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {
return "4";

View File

@ -30,10 +30,6 @@ import org.junit.jupiter.api.Test;
*/
public class TransformedSortedBagTest<T> extends AbstractSortedBagTest<T> {
public TransformedSortedBagTest() {
super(TransformedSortedBagTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {
return "4";

View File

@ -29,10 +29,6 @@ import org.junit.jupiter.api.Test;
*/
public class TreeBagTest<T> extends AbstractSortedBagTest<T> {
public TreeBagTest() {
super(TreeBagTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {
return "4";

View File

@ -33,10 +33,6 @@ import org.junit.jupiter.api.Test;
*/
public class UnmodifiableBagTest<E> extends AbstractBagTest<E> {
public UnmodifiableBagTest() {
super(UnmodifiableBagTest.class.getSimpleName());
}
@Override
public Bag<E> getCollection() {
return super.getCollection();

View File

@ -33,10 +33,6 @@ import org.junit.jupiter.api.Test;
*/
public class UnmodifiableSortedBagTest<E> extends AbstractSortedBagTest<E> {
public UnmodifiableSortedBagTest() {
super(UnmodifiableSortedBagTest.class.getSimpleName());
}
@Override
public SortedBag<E> getCollection() {
return super.getCollection();

View File

@ -110,10 +110,6 @@ public abstract class AbstractBidiMapTest<K, V> extends AbstractIterableMapTest<
public class TestBidiMapIterator extends AbstractMapIteratorTest<K, V> {
public TestBidiMapIterator() {
super("TestBidiMapIterator");
}
@Override
public V[] addSetValues() {
return getNewSampleValues();
@ -240,14 +236,6 @@ public abstract class AbstractBidiMapTest<K, V> extends AbstractIterableMapTest<
}
}
public AbstractBidiMapTest() {
super("Inverse");
}
public AbstractBidiMapTest(final String testName) {
super(testName);
}
public BulkTest bulkTestBidiMapIterator() {
return new TestBidiMapIterator();
}

View File

@ -55,10 +55,6 @@ public abstract class AbstractOrderedBidiMapDecoratorTest<K, V>
}
}
public AbstractOrderedBidiMapDecoratorTest(final String testName) {
super(testName);
}
@Override
public boolean isAllowNullKey() {
return false;

View File

@ -40,10 +40,6 @@ public abstract class AbstractOrderedBidiMapTest<K, V> extends AbstractBidiMapTe
public class TestBidiOrderedMapIterator extends AbstractMapIteratorTest<K, V> {
public TestBidiOrderedMapIterator() {
super("TestBidiOrderedMapIterator");
}
@Override
public V[] addSetValues() {
return getNewSampleValues();
@ -91,13 +87,6 @@ public abstract class AbstractOrderedBidiMapTest<K, V> extends AbstractBidiMapTe
}
public AbstractOrderedBidiMapTest() {
}
public AbstractOrderedBidiMapTest(final String testName) {
super(testName);
}
public BulkTest bulkTestOrderedMapIterator() {
return new TestBidiOrderedMapIterator();
}

View File

@ -45,8 +45,7 @@ public abstract class AbstractSortedBidiMapTest<K extends Comparable<K>, V exten
protected List<V> sortedValues = new ArrayList<>();
protected SortedSet<V> sortedNewValues = new TreeSet<>();
public AbstractSortedBidiMapTest(final String testName) {
super(testName);
public AbstractSortedBidiMapTest() {
sortedKeys = getAsList(getSampleKeys());
Collections.sort(sortedKeys);
sortedKeys = Collections.unmodifiableList(sortedKeys);

View File

@ -26,10 +26,6 @@ import org.apache.commons.collections4.collection.AbstractCollectionTest;
*/
public class DualHashBidiMapTest<K, V> extends AbstractBidiMapTest<K, V> {
public DualHashBidiMapTest() {
super(DualHashBidiMapTest.class.getSimpleName());
}
@Override
protected int getIterationBehaviour() {
return AbstractCollectionTest.UNORDERED;

View File

@ -24,10 +24,6 @@ package org.apache.commons.collections4.bidimap;
*/
public class DualLinkedHashBidiMapTest<K, V> extends AbstractBidiMapTest<K, V> {
public DualLinkedHashBidiMapTest() {
super(DualLinkedHashBidiMapTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {
return "4";

View File

@ -52,7 +52,7 @@ public class DualTreeBidiMap2Test<K extends Comparable<K>, V extends Comparable<
}
public DualTreeBidiMap2Test() {
super(DualTreeBidiMap2Test.class.getSimpleName());
super();
}
@Override

View File

@ -22,7 +22,7 @@ package org.apache.commons.collections4.bidimap;
public class DualTreeBidiMapTest<K extends Comparable<K>, V extends Comparable<V>> extends AbstractSortedBidiMapTest<K, V> {
public DualTreeBidiMapTest() {
super(DualTreeBidiMapTest.class.getSimpleName());
super();
}
/**

View File

@ -25,10 +25,6 @@ import org.apache.commons.collections4.BidiMap;
*/
public class TreeBidiMapTest<K extends Comparable<K>, V extends Comparable<V>> extends AbstractOrderedBidiMapTest<K, V> {
public TreeBidiMapTest() {
super(TreeBidiMapTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {
return "4";

View File

@ -36,10 +36,6 @@ import org.junit.jupiter.api.Test;
*/
public class UnmodifiableBidiMapTest<K, V> extends AbstractBidiMapTest<K, V> {
public UnmodifiableBidiMapTest() {
super(UnmodifiableBidiMapTest.class.getSimpleName());
}
@Override
protected int getIterationBehaviour() {
return AbstractCollectionTest.UNORDERED;

View File

@ -32,10 +32,6 @@ import org.junit.jupiter.api.Test;
*/
public class UnmodifiableOrderedBidiMapTest<K extends Comparable<K>, V extends Comparable<V>> extends AbstractOrderedBidiMapTest<K, V> {
public UnmodifiableOrderedBidiMapTest() {
super(UnmodifiableOrderedBidiMapTest.class.getSimpleName());
}
/**
* Override to prevent infinite recursion of tests.
*/

View File

@ -33,7 +33,7 @@ import org.junit.jupiter.api.Test;
public class UnmodifiableSortedBidiMapTest<K extends Comparable<K>, V extends Comparable<V>> extends AbstractSortedBidiMapTest<K, V> {
public UnmodifiableSortedBidiMapTest() {
super(UnmodifiableSortedBidiMapTest.class.getSimpleName());
super();
}
@Override

View File

@ -259,15 +259,6 @@ public abstract class AbstractCollectionTest<E> extends AbstractObjectTest {
*/
private Collection<E> confirmed;
/**
* JUnit constructor.
*
* @param testName the test class name
*/
public AbstractCollectionTest(final String testName) {
super(testName);
}
/**
* Specifies whether equal elements in the collection are, in fact,
* distinguishable with information not readily available. That is, if a

View File

@ -43,10 +43,6 @@ public class CompositeCollectionTest<E> extends AbstractCollectionTest<E> {
protected Collection<E> two;
public CompositeCollectionTest() {
super(CompositeCollectionTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {
return "4";

View File

@ -45,10 +45,6 @@ public class IndexedCollectionTest extends AbstractCollectionTest<String> {
}
}
public IndexedCollectionTest() {
super(IndexedCollectionTest.class.getSimpleName());
}
protected Collection<String> decorateCollection(final Collection<String> collection) {
return IndexedCollection.nonUniqueIndexedCollection(collection, new IntegerTransformer());
}

View File

@ -39,10 +39,6 @@ public class PredicatedCollectionTest<E> extends AbstractCollectionTest<E> {
protected Predicate<E> testPredicate =
String.class::isInstance;
public PredicatedCollectionTest() {
super(PredicatedCollectionTest.class.getSimpleName());
}
protected Collection<E> decorateCollection(
final Collection<E> collection, final Predicate<E> predicate) {
return PredicatedCollection.predicatedCollection(collection, predicate);

View File

@ -26,10 +26,6 @@ import java.util.Collection;
*/
public class SynchronizedCollectionTest<E> extends AbstractCollectionTest<E> {
public SynchronizedCollectionTest() {
super(SynchronizedCollectionTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {
return "4";

View File

@ -54,10 +54,6 @@ public class TransformedCollectionTest extends AbstractCollectionTest<Object> {
public static final Transformer<Object, Object> STRING_TO_INTEGER_TRANSFORMER = new StringToInteger();
public static final Transformer<Object, Object> TO_LOWER_CASE_TRANSFORMER = new ToLowerCase();
public TransformedCollectionTest() {
super(TransformedCollectionTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {
return "4";

View File

@ -35,10 +35,6 @@ import org.junit.jupiter.api.Test;
*/
public class UnmodifiableBoundedCollectionTest<E> extends AbstractCollectionTest<E> {
public UnmodifiableBoundedCollectionTest() {
super(UnmodifiableBoundedCollectionTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {
return "4";

View File

@ -34,10 +34,6 @@ import org.junit.jupiter.api.Test;
*/
public class UnmodifiableCollectionTest<E> extends AbstractCollectionTest<E> {
public UnmodifiableCollectionTest() {
super(UnmodifiableCollectionTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {
return "4";

View File

@ -39,15 +39,6 @@ import org.junit.jupiter.api.Test;
*/
public abstract class AbstractComparatorTest<T> extends AbstractObjectTest {
/**
* JUnit constructor.
*
* @param testName the test class name
*/
public AbstractComparatorTest(final String testName) {
super(testName);
}
public String getCanonicalComparatorName(final Object object) {
final StringBuilder retval = new StringBuilder();
retval.append(TEST_DATA_PATH);

View File

@ -30,10 +30,6 @@ public abstract class AbstractNullComparatorTest extends AbstractComparatorTest<
**/
public static class TestNullComparator1 extends AbstractNullComparatorTest {
public TestNullComparator1(final String testName) {
super(testName);
}
@Override
public String getCanonicalComparatorName(final Object object) {
return super.getCanonicalComparatorName(object) + "1";
@ -72,10 +68,6 @@ public abstract class AbstractNullComparatorTest extends AbstractComparatorTest<
**/
public static class TestNullComparator2 extends AbstractNullComparatorTest {
public TestNullComparator2(final String testName) {
super(testName);
}
@Override
public String getCanonicalComparatorName(final Object object) {
return super.getCanonicalComparatorName(object) + "2";
@ -109,7 +101,4 @@ public abstract class AbstractNullComparatorTest extends AbstractComparatorTest<
}
public AbstractNullComparatorTest(final String testName) {
super(testName);
}
}

View File

@ -37,10 +37,6 @@ import org.junit.jupiter.api.Test;
@SuppressWarnings("boxing")
public class BooleanComparatorTest extends AbstractComparatorTest<Boolean> {
public BooleanComparatorTest() {
super(BooleanComparatorTest.class.getSimpleName());
}
protected void allTests(final boolean trueFirst, final BooleanComparator comp) {
orderIndependentTests(comp);
if (trueFirst) {

View File

@ -26,10 +26,6 @@ import java.util.List;
@SuppressWarnings("boxing")
public class ComparableComparatorTest extends AbstractComparatorTest<Integer> {
public ComparableComparatorTest() {
super(ComparableComparatorTest.class.getSimpleName());
}
@Override
public List<Integer> getComparableObjectsOrdered() {
final List<Integer> list = new LinkedList<>();

View File

@ -93,10 +93,6 @@ public class ComparatorChainTest extends AbstractComparatorTest<ComparatorChainT
}
}
public ComparatorChainTest() {
super(ComparatorChainTest.class.getSimpleName());
}
// public void testCreate() throws Exception {
// writeExternalFormToDisk((java.io.Serializable) makeObject(), "src/test/resources/data/test/ComparatorChain.version4.obj");
// }

View File

@ -126,14 +126,6 @@ public class FixedOrderComparatorTest extends AbstractComparatorTest<String> {
"Buenos Aires"
};
//
// Set up and tear down
//
public FixedOrderComparatorTest() {
super(FixedOrderComparatorTest.class.getSimpleName());
}
/** Shuffles the keys and asserts that the comparator sorts them back to
* their original order.
*/

View File

@ -34,10 +34,6 @@ import org.junit.jupiter.api.Test;
*/
public class ReverseComparatorTest extends AbstractComparatorTest<Integer> {
public ReverseComparatorTest() {
super(ReverseComparatorTest.class.getSimpleName());
}
@Override
public List<Integer> getComparableObjectsOrdered() {
final List<Integer> list = new LinkedList<>();

View File

@ -32,18 +32,6 @@ import org.junit.jupiter.api.Test;
*/
public class TransformingComparatorTest extends AbstractComparatorTest<Integer> {
//
// Initialization and busywork
//
public TransformingComparatorTest() {
super(TransformingComparatorTest.class.getSimpleName());
}
//
// Set up and tear down
//
@Override
@SuppressWarnings("boxing") // OK in test code
public List<Integer> getComparableObjectsOrdered() {
@ -86,8 +74,4 @@ public class TransformingComparatorTest extends AbstractComparatorTest<Integer>
// writeExternalFormToDisk((java.io.Serializable) makeObject(), "src/test/resources/data/test/TransformingComparator.version4.obj");
// }
//
// The tests
//
}

View File

@ -45,15 +45,6 @@ import org.junit.jupiter.api.Test;
*/
public abstract class AbstractIteratorTest<E> extends AbstractObjectTest {
/**
* JUnit constructor.
*
* @param testName the test class name
*/
public AbstractIteratorTest(final String testName) {
super(testName);
}
/**
* Implement this method to return an iterator over an empty collection.
*

View File

@ -41,15 +41,6 @@ import org.junit.jupiter.api.Test;
*/
public abstract class AbstractListIteratorTest<E> extends AbstractIteratorTest<E> {
/**
* JUnit constructor.
*
* @param testName the test class name
*/
public AbstractListIteratorTest(final String testName) {
super(testName);
}
/**
* The value to be used in the add and set tests.
* Default is null.

View File

@ -45,15 +45,6 @@ import org.junit.jupiter.api.Test;
*/
public abstract class AbstractMapIteratorTest<K, V> extends AbstractIteratorTest<K> {
/**
* JUnit constructor.
*
* @param testName the test class name
*/
public AbstractMapIteratorTest(final String testName) {
super(testName);
}
/**
* The values to be used in the add and set tests.
* Default is two strings.

View File

@ -46,15 +46,6 @@ import org.junit.jupiter.api.Test;
*/
public abstract class AbstractOrderedMapIteratorTest<K, V> extends AbstractMapIteratorTest<K, V> {
/**
* JUnit constructor.
*
* @param testName the test class name
*/
public AbstractOrderedMapIteratorTest(final String testName) {
super(testName);
}
@Override
public abstract OrderedMapIterator<K, V> makeEmptyIterator();

View File

@ -35,10 +35,6 @@ public class ArrayIterator2Test<E> extends AbstractIteratorTest<E> {
protected int[] testArray = { 2, 4, 6, 8 };
public ArrayIterator2Test() {
super(ArrayIterator2Test.class.getSimpleName());
}
public ArrayIterator<E> makeArrayIterator(final Object array) {
return new ArrayIterator<>(array);
}

View File

@ -36,10 +36,6 @@ public class ArrayIteratorTest<E> extends AbstractIteratorTest<E> {
protected String[] testArray = { "One", "Two", "Three" };
public ArrayIteratorTest() {
super(ArrayIteratorTest.class.getSimpleName());
}
@Override
public ArrayIterator<E> makeEmptyIterator() {
return new ArrayIterator<>(new Object[0]);

View File

@ -23,9 +23,6 @@ package org.apache.commons.collections4.iterators;
*/
public class ArrayListIterator2Test<E> extends ArrayIterator2Test<E> {
public ArrayListIterator2Test() {
}
public ArrayListIterator<E> makeArrayListIterator(final Object array) {
return new ArrayListIterator<>(array);
}

View File

@ -33,9 +33,6 @@ import org.junit.jupiter.api.Test;
*/
public class ArrayListIteratorTest<E> extends ArrayIteratorTest<E> {
public ArrayListIteratorTest() {
}
public ArrayListIterator<E> makeArrayListIterator(final Object array) {
return new ArrayListIterator<>(array);
}

View File

@ -46,10 +46,6 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
private List<E> testList;
public BoundedIteratorTest() {
super(BoundedIteratorTest.class.getSimpleName());
}
@Override
public Iterator<E> makeEmptyIterator() {
return new BoundedIterator<>(Collections.<E>emptyList().iterator(), 0, 10);

View File

@ -42,10 +42,6 @@ public class CartesianProductIteratorTest extends AbstractIteratorTest<List<Char
private List<Character> symbols;
private List<Character> emptyList;
public CartesianProductIteratorTest() {
super(CartesianProductIteratorTest.class.getSimpleName());
}
@Override
public CartesianProductIterator<Character> makeEmptyIterator() {
return new CartesianProductIterator<>();

View File

@ -38,26 +38,17 @@ import org.junit.jupiter.api.Test;
@SuppressWarnings("boxing")
public class CollatingIteratorTest extends AbstractIteratorTest<Integer> {
//------------------------------------------------------------ Conventional
private Comparator<Integer> comparator;
//--------------------------------------------------------------- Lifecycle
private ArrayList<Integer> evens;
private ArrayList<Integer> odds;
private ArrayList<Integer> fib;
public CollatingIteratorTest() {
super(CollatingIteratorTest.class.getSimpleName());
}
@Override
public CollatingIterator<Integer> makeEmptyIterator() {
return new CollatingIterator<>(comparator);
}
//---------------------------------------------------- TestIterator Methods
@Override
public CollatingIterator<Integer> makeObject() {
final CollatingIterator<Integer> iter = new CollatingIterator<>(comparator);
@ -90,8 +81,6 @@ public class CollatingIteratorTest extends AbstractIteratorTest<Integer> {
fib.add(21);
}
//------------------------------------------------------------------- Tests
@Test
public void testGetSetComparator() {
final CollatingIterator<Integer> iter = new CollatingIterator<>();

View File

@ -56,11 +56,6 @@ public class FilterIteratorTest<E> extends AbstractIteratorTest<E> {
private List<E> list;
private FilterIterator<E> iterator;
/** Creates new TestFilterIterator */
public FilterIteratorTest() {
super(FilterIteratorTest.class.getSimpleName());
}
private void initIterator() {
iterator = makeObject();
}

View File

@ -45,10 +45,6 @@ public class IteratorChainTest extends AbstractIteratorTest<String> {
protected List<String> list2;
protected List<String> list3;
public IteratorChainTest() {
super(IteratorChainTest.class.getSimpleName());
}
public List<String> getList1() {
return list1;
}

View File

@ -32,10 +32,6 @@ import org.junit.jupiter.api.Test;
*/
public class IteratorIterableTest extends BulkTest {
public IteratorIterableTest() {
super(IteratorIterableTest.class.getSimpleName());
}
private Iterator<Integer> createIterator() {
final List<Integer> list = new ArrayList<>();
list.add(Integer.valueOf(0));

View File

@ -45,10 +45,6 @@ public class LazyIteratorChainTest extends AbstractIteratorTest<String> {
protected List<String> list2;
protected List<String> list3;
public LazyIteratorChainTest() {
super(LazyIteratorChainTest.class.getSimpleName());
}
@Override
public LazyIteratorChain<String> makeEmptyIterator() {
return new LazyIteratorChain<String>() {

View File

@ -42,10 +42,6 @@ public class ListIteratorWrapper2Test<E> extends AbstractIteratorTest<E> {
protected List<E> list1;
public ListIteratorWrapper2Test() {
super(ListIteratorWrapper2Test.class.getSimpleName());
}
@Override
public ResettableListIterator<E> makeEmptyIterator() {
final ArrayList<E> list = new ArrayList<>();

View File

@ -43,11 +43,6 @@ public class ListIteratorWrapperTest<E> extends AbstractIteratorTest<E> {
protected List<E> list1;
public ListIteratorWrapperTest() {
super(ListIteratorWrapperTest.class.getSimpleName());
}
@Override
public ResettableListIterator<E> makeEmptyIterator() {
final ArrayList<E> list = new ArrayList<>();
return new ListIteratorWrapper<>(list.iterator());

View File

@ -42,13 +42,6 @@ public class NodeListIteratorTest extends AbstractIteratorTest<Node> {
// control, which constructor to use in makeObject() and makeEmptyIterator
private boolean createIteratorWithStandardConstr = true;
/**
* Junit Constructor
*/
public NodeListIteratorTest() {
super(NodeListIteratorTest.class.getSimpleName());
}
@Override
public Iterator<Node> makeEmptyIterator() {
final NodeList emptyNodeList = new NodeList() {

View File

@ -34,10 +34,6 @@ public class ObjectArrayIteratorTest<E> extends AbstractIteratorTest<E> {
protected String[] testArray = { "One", "Two", "Three" };
public ObjectArrayIteratorTest() {
super(ObjectArrayIteratorTest.class.getSimpleName());
}
@SuppressWarnings("unchecked")
public ObjectArrayIterator<E> makeArrayIterator() {
return new ObjectArrayIterator<>();

View File

@ -25,10 +25,6 @@ public class ObjectArrayListIterator2Test<E> extends AbstractListIteratorTest<E>
protected String[] testArray = { "One", "Two", "Three" };
public ObjectArrayListIterator2Test() {
super(ObjectArrayListIterator2Test.class.getSimpleName());
}
public ObjectArrayListIterator<E> makeArrayListIterator(final E[] array) {
return new ObjectArrayListIterator<>(array);
}

View File

@ -33,9 +33,6 @@ import org.junit.jupiter.api.Test;
*/
public class ObjectArrayListIteratorTest<E> extends ObjectArrayIteratorTest<E> {
public ObjectArrayListIteratorTest() {
}
public ObjectArrayListIterator<E> makeArrayListIterator(final E[] array) {
return new ObjectArrayListIterator<>(array);
}

View File

@ -136,10 +136,6 @@ public class ObjectGraphIteratorTest extends AbstractIteratorTest<Object> {
protected List<Iterator<String>> iteratorList;
public ObjectGraphIteratorTest() {
super(ObjectGraphIteratorTest.class.getSimpleName());
}
@Override
public ObjectGraphIterator<Object> makeEmptyIterator() {
final ArrayList<Object> list = new ArrayList<>();

View File

@ -43,10 +43,6 @@ public class PeekingIteratorTest<E> extends AbstractIteratorTest<E> {
private List<E> testList;
public PeekingIteratorTest() {
super(PeekingIteratorTest.class.getSimpleName());
}
@Override
public Iterator<E> makeEmptyIterator() {
return PeekingIterator.peekingIterator(Collections.<E>emptyList().iterator());

View File

@ -41,10 +41,6 @@ public class PermutationIteratorTest extends AbstractIteratorTest<List<Character
protected Character[] testArray = { 'A', 'B', 'C' };
protected List<Character> testList;
public PermutationIteratorTest() {
super(PermutationIteratorTest.class.getSimpleName());
}
@Override
public PermutationIterator<Character> makeEmptyIterator() {
return new PermutationIterator<>(new ArrayList<>());

View File

@ -40,10 +40,6 @@ public class PushbackIteratorTest<E> extends AbstractIteratorTest<E> {
private List<E> testList;
public PushbackIteratorTest() {
super(PushbackIteratorTest.class.getSimpleName());
}
@Override
public Iterator<E> makeEmptyIterator() {
return PushbackIterator.pushbackIterator(Collections.<E>emptyList().iterator());

View File

@ -40,10 +40,6 @@ public class ReverseListIteratorTest<E> extends AbstractListIteratorTest<E> {
protected String[] testArray = { "One", "Two", "Three", "Four" };
public ReverseListIteratorTest() {
super(ReverseListIteratorTest.class.getSimpleName());
}
@Override
public ListIterator<E> makeEmptyIterator() {
return new ReverseListIterator<>(new ArrayList<>());

View File

@ -37,10 +37,6 @@ public class SingletonIterator2Test<E> extends AbstractIteratorTest<E> {
private static final Object testValue = "foo";
public SingletonIterator2Test() {
super(SingletonIterator2Test.class.getSimpleName());
}
@Override
@SuppressWarnings("unchecked")
public SingletonIterator<E> makeEmptyIterator() {

View File

@ -37,10 +37,6 @@ public class SingletonIteratorTest<E> extends AbstractIteratorTest<E> {
private static final Object testValue = "foo";
public SingletonIteratorTest() {
super(SingletonIteratorTest.class.getSimpleName());
}
/**
* Returns a SingletonIterator from which
* the element has already been removed.

View File

@ -36,10 +36,6 @@ public class SingletonListIteratorTest<E> extends AbstractListIteratorTest<E> {
private static final Object testValue = "foo";
public SingletonListIteratorTest() {
super(SingletonListIteratorTest.class.getSimpleName());
}
/**
* Returns a SingletonListIterator from which
* the element has already been removed.

View File

@ -45,10 +45,6 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> {
private List<E> testList;
public SkippingIteratorTest() {
super(SkippingIteratorTest.class.getSimpleName());
}
@Override
public Iterator<E> makeEmptyIterator() {
return new SkippingIterator<>(Collections.<E>emptyList().iterator(), 0);

View File

@ -41,10 +41,6 @@ public class UniqueFilterIteratorTest<E> extends AbstractIteratorTest<E> {
protected List<E> list1;
public UniqueFilterIteratorTest() {
super(UniqueFilterIteratorTest.class.getSimpleName());
}
@Override
public UniqueFilterIterator<E> makeEmptyIterator() {
final ArrayList<E> list = new ArrayList<>();

View File

@ -41,10 +41,6 @@ public class UnmodifiableIteratorTest<E> extends AbstractIteratorTest<E> {
protected String[] testArray = { "One", "Two", "Three" };
protected List<E> testList;
public UnmodifiableIteratorTest() {
super(UnmodifiableIteratorTest.class.getSimpleName());
}
@Override
public Iterator<E> makeEmptyIterator() {
return UnmodifiableIterator.unmodifiableIterator(Collections.<E>emptyList().iterator());

View File

@ -41,10 +41,6 @@ public class UnmodifiableListIteratorTest<E> extends AbstractListIteratorTest<E>
protected String[] testArray = {"One", "Two", "Three"};
protected List<E> testList;
public UnmodifiableListIteratorTest() {
super(UnmodifiableListIteratorTest.class.getSimpleName());
}
@Override
public ListIterator<E> makeEmptyIterator() {
return UnmodifiableListIterator.unmodifiableListIterator(Collections.<E>emptyList().listIterator());

View File

@ -38,11 +38,6 @@ import org.junit.jupiter.api.Test;
*/
public class UnmodifiableMapIteratorTest<K, V> extends AbstractMapIteratorTest<K, V> {
public UnmodifiableMapIteratorTest() {
super(UnmodifiableMapIteratorTest.class.getSimpleName());
}
@Override
@SuppressWarnings("unchecked")
public Map<K, V> getConfirmedMap() {
final Map<K, V> testMap = new HashMap<>();

View File

@ -39,10 +39,6 @@ import org.junit.jupiter.api.Test;
*/
public class UnmodifiableOrderedMapIteratorTest<K, V> extends AbstractOrderedMapIteratorTest<K, V> {
public UnmodifiableOrderedMapIteratorTest() {
super(UnmodifiableOrderedMapIteratorTest.class.getSimpleName());
}
@Override
@SuppressWarnings("unchecked")
public Map<K, V> getConfirmedMap() {

View File

@ -32,17 +32,10 @@ import org.junit.jupiter.api.Test;
@SuppressWarnings("boxing")
public class ZippingIteratorTest extends AbstractIteratorTest<Integer> {
//------------------------------------------------------------ Conventional
private ArrayList<Integer> evens;
//--------------------------------------------------------------- Lifecycle
private ArrayList<Integer> odds;
private ArrayList<Integer> fib;
public ZippingIteratorTest() {
super(ZippingIteratorTest.class.getSimpleName());
}
@Override
@SuppressWarnings("unchecked")
@ -50,8 +43,6 @@ public class ZippingIteratorTest extends AbstractIteratorTest<Integer> {
return new ZippingIterator<>(IteratorUtils.<Integer>emptyIterator());
}
//---------------------------------------------------- TestIterator Methods
@Override
public ZippingIterator<Integer> makeObject() {
return new ZippingIterator<>(evens.iterator(), odds.iterator(), fib.iterator());
@ -79,8 +70,6 @@ public class ZippingIteratorTest extends AbstractIteratorTest<Integer> {
fib.add(21);
}
//------------------------------------------------------------------- Tests
@Test
public void testIterateEven() {
@SuppressWarnings("unchecked")

View File

@ -28,10 +28,6 @@ import org.junit.jupiter.api.Test;
*/
public abstract class AbstractLinkedListTest<E> extends AbstractListTest<E> {
public AbstractLinkedListTest(final String testName) {
super(testName);
}
protected void checkNodes() {
final AbstractLinkedList<E> list = getCollection();
for (int i = 0; i < list.size; i++) {

View File

@ -39,7 +39,6 @@ import java.util.NoSuchElementException;
import org.apache.commons.collections4.BulkTest;
import org.apache.commons.collections4.collection.AbstractCollectionTest;
import org.apache.commons.collections4.iterators.AbstractListIteratorTest;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.Test;
/**
@ -64,7 +63,6 @@ public abstract class AbstractListTest<E> extends AbstractCollectionTest<E> {
private final AbstractListTest<E> outer;
public BulkTestSubList(final AbstractListTest<E> outer) {
super(StringUtils.EMPTY);
this.outer = outer;
}
@ -134,9 +132,6 @@ public abstract class AbstractListTest<E> extends AbstractCollectionTest<E> {
}
public class TestListIterator extends AbstractListIteratorTest<E> {
public TestListIterator() {
super("TestListIterator");
}
@Override
public E addSetValue() {
@ -171,15 +166,6 @@ public abstract class AbstractListTest<E> extends AbstractCollectionTest<E> {
}
}
/**
* JUnit constructor.
*
* @param testName the test class name
*/
public AbstractListTest(final String testName) {
super(testName);
}
/**
* Traverses to the beginning of the given iterator.
*

View File

@ -44,9 +44,6 @@ import org.junit.jupiter.api.Test;
public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
private CursorableLinkedList<E> list;
public CursorableLinkedListTest() {
super(CursorableLinkedListTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {

View File

@ -61,10 +61,6 @@ public class DefaultAbstractLinkedListJava21Test<E> extends AbstractListTest<E>
}
}
public DefaultAbstractLinkedListJava21Test() {
super(DefaultAbstractLinkedListJava21Test.class.getSimpleName());
}
protected void checkNodes() {
final AbstractLinkedListJava21<E> list = getCollection();
for (int i = 0; i < list.size; i++) {

View File

@ -33,10 +33,6 @@ import org.junit.jupiter.api.Test;
*/
public class FixedSizeListTest<E> extends AbstractListTest<E> {
public FixedSizeListTest() {
super(FixedSizeListTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {
return "4";

View File

@ -33,10 +33,6 @@ import org.junit.jupiter.api.function.Executable;
*/
public class GrowthListTest<E> extends AbstractListTest<E> {
public GrowthListTest() {
super(GrowthListTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {
return "4";

View File

@ -33,10 +33,6 @@ import org.junit.jupiter.api.Test;
public class LazyListTest extends AbstractObjectTest {
public LazyListTest() {
super(LazyListTest.class.getSimpleName());
}
@Override
public Object makeObject() {
final Factory<LocalDateTime> dateFactory = LocalDateTime::now;

View File

@ -94,10 +94,6 @@ public class NodeCachingLinkedListTest<E> extends AbstractLinkedListTest<E> {
}
public NodeCachingLinkedListTest() {
super(NodeCachingLinkedListTest.class.getSimpleName());
}
/**
* {@inheritDoc}
*/

View File

@ -40,10 +40,6 @@ public class PredicatedListTest<E> extends AbstractListTest<E> {
protected Predicate<E> testPredicate =
String.class::isInstance;
public PredicatedListTest() {
super(PredicatedListTest.class.getSimpleName());
}
protected List<E> decorateList(final List<E> list, final Predicate<E> predicate) {
return PredicatedList.predicatedList(list, predicate);
}

View File

@ -54,10 +54,6 @@ public class SetUniqueListTest<E> extends AbstractListTest<E> {
boolean extraVerify = true;
public SetUniqueListTest() {
super(SetUniqueListTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {
return "4";

View File

@ -37,10 +37,6 @@ import org.junit.jupiter.api.Test;
*/
public class TransformedListTest<E> extends AbstractListTest<E> {
public TransformedListTest() {
super(TransformedListTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {
return "4";

View File

@ -95,10 +95,6 @@ public class TreeListTest<E> extends AbstractListTest<E> {
// benchmark(new NodeCachingLinkedList());
// }
public TreeListTest() {
super(TreeListTest.class.getSimpleName());
}
@Override
public TreeList<E> makeObject() {
return new TreeList<>();

View File

@ -37,10 +37,6 @@ public class UnmodifiableListTest<E> extends AbstractListTest<E> {
protected ArrayList<E> array;
public UnmodifiableListTest() {
super(UnmodifiableListTest.class.getSimpleName());
}
@Override
public String getCompatibilityVersion() {
return "4";

View File

@ -31,10 +31,6 @@ public abstract class AbstractConcurrentReferenceHashMapTest<K, V> extends Abstr
protected static final EnumSet<Option> IDENTITY_COMPARISONS = EnumSet.of(Option.IDENTITY_COMPARISONS);
public AbstractConcurrentReferenceHashMapTest() {
super(AbstractConcurrentReferenceHashMapTest.class.getSimpleName());
}
@Override
public boolean isAllowNullKey() {
return false;

View File

@ -37,9 +37,6 @@ import org.junit.jupiter.api.Test;
public abstract class AbstractIterableMapTest<K, V> extends AbstractMapTest<IterableMap<K, V>, K, V> {
public class InnerTestMapIterator extends AbstractMapIteratorTest<K, V> {
public InnerTestMapIterator() {
super("InnerTestMapIterator");
}
@Override
public V[] addSetValues() {
@ -92,15 +89,6 @@ public abstract class AbstractIterableMapTest<K, V> extends AbstractMapTest<Iter
}
}
/**
* JUnit constructor.
*
* @param testName the test name
*/
public AbstractIterableMapTest(final String testName) {
super(testName);
}
public BulkTest bulkTestMapIterator() {
return new InnerTestMapIterator();
}

View File

@ -49,7 +49,6 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.collection.AbstractCollectionTest;
import org.apache.commons.collections4.keyvalue.DefaultMapEntry;
import org.apache.commons.collections4.set.AbstractSetTest;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
@ -140,9 +139,6 @@ import org.junit.jupiter.api.Test;
public abstract class AbstractMapTest<M extends Map<K, V>, K, V> extends AbstractObjectTest {
public class TestMapEntrySet extends AbstractSetTest<Map.Entry<K, V>> {
public TestMapEntrySet() {
super("MapEntrySet");
}
@Override
public boolean areEqualElementsDistinguishable() {
@ -327,9 +323,6 @@ public abstract class AbstractMapTest<M extends Map<K, V>, K, V> extends Abstrac
}
public class TestMapKeySet extends AbstractSetTest<K> {
public TestMapKeySet() {
super(StringUtils.EMPTY);
}
@Override
public K[] getFullElements() {
@ -407,9 +400,6 @@ public abstract class AbstractMapTest<M extends Map<K, V>, K, V> extends Abstrac
// are still equal to the confirmed's collection views.
public class TestMapValues extends AbstractCollectionTest<V> {
public TestMapValues() {
super(StringUtils.EMPTY);
}
@Override
public boolean areEqualElementsDistinguishable() {
@ -527,15 +517,6 @@ public abstract class AbstractMapTest<M extends Map<K, V>, K, V> extends Abstrac
/** HashMap created by reset(). */
protected Map<K, V> confirmed;
/**
* JUnit constructor.
*
* @param testName the test name
*/
public AbstractMapTest(final String testName) {
super(testName);
}
/**
* Helper method to add all the mappings described by {@link #getSampleKeys()} and {@link #getSampleValues()}.
*/

View File

@ -45,9 +45,6 @@ import org.junit.jupiter.api.Test;
public abstract class AbstractOrderedMapTest<K, V> extends AbstractIterableMapTest<K, V> {
public class InnerTestOrderedMapIterator extends AbstractOrderedMapIteratorTest<K, V> {
public InnerTestOrderedMapIterator() {
super("InnerTestOrderedMapIterator");
}
@Override
public Map<K, V> getConfirmedMap() {
@ -95,15 +92,6 @@ public abstract class AbstractOrderedMapTest<K, V> extends AbstractIterableMapTe
}
}
/**
* JUnit constructor.
*
* @param testName the test name
*/
public AbstractOrderedMapTest(final String testName) {
super(testName);
}
public BulkTest bulkTestOrderedMapIterator() {
return new InnerTestOrderedMapIterator();
}

Some files were not shown because too many files have changed in this diff Show More