This commit is contained in:
Gary Gregory 2022-11-26 07:26:41 -05:00
commit 8279d9ba46
64 changed files with 189 additions and 161 deletions

View File

@ -19,8 +19,8 @@ package org.apache.commons.collections4.bidimap;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.Objects;
import java.util.Set;
import java.util.function.Predicate;
import org.apache.commons.collections4.BidiMap;

View File

@ -17,14 +17,13 @@
package org.apache.commons.collections4.map;
import java.io.Serializable;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import org.apache.commons.collections4.set.CompositeSet;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.collection.CompositeCollection;
import org.apache.commons.collections4.set.CompositeSet;
/**
* Decorates a map of other maps to provide a single unified view.

View File

@ -26,8 +26,8 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;
import org.apache.commons.collections4.CollectionUtils;

View File

@ -19,8 +19,8 @@ package org.apache.commons.collections4.multimap;
import java.io.Serializable;
import java.util.Collection;
import java.util.Map;
import java.util.Objects;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;
import org.apache.commons.collections4.MapIterator;

View File

@ -23,8 +23,8 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.Objects;
import java.util.Set;
import java.util.function.Predicate;
import org.apache.commons.collections4.CollectionUtils;

View File

@ -20,7 +20,6 @@ import java.io.Serializable;
import java.util.AbstractMap;
import java.util.Map;
import java.util.Objects;
import java.util.Map.Entry;
import org.apache.commons.collections4.Trie;

View File

@ -16,8 +16,6 @@
*/
package org.apache.commons.collections4;
import org.junit.jupiter.api.Test;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@ -30,6 +28,8 @@ import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;
import org.junit.jupiter.api.Test;
/**
* Abstract test class for {@link java.lang.Object} methods and contracts.
* <p>

View File

@ -23,8 +23,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.Arrays;
@ -54,6 +54,7 @@ import org.apache.commons.collections4.collection.TransformedCollection;
import org.apache.commons.collections4.collection.UnmodifiableCollection;
import org.apache.commons.collections4.functors.DefaultEquator;
import org.apache.commons.collections4.queue.CircularFifoQueue;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -1029,7 +1030,7 @@ public class CollectionUtilsTest extends MockTestCase {
@Test
public void reverse() {
CollectionUtils.reverseArray(new Object[] {});
final Integer[] a = collectionA.toArray(new Integer[collectionA.size()]);
final Integer[] a = collectionA.toArray(ArrayUtils.EMPTY_INTEGER_OBJECT_ARRAY);
CollectionUtils.reverseArray(a);
// assume our implementation is correct if it returns the same order as the Java function
Collections.reverse(collectionA);

View File

@ -23,9 +23,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.ArrayList;
import java.util.Arrays;

View File

@ -26,27 +26,36 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Vector;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.Set;
import java.util.LinkedHashSet;
import java.util.Vector;
import org.apache.commons.collections4.iterators.*;
import org.apache.commons.collections4.iterators.ArrayIterator;
import org.apache.commons.collections4.iterators.EmptyIterator;
import org.apache.commons.collections4.iterators.EmptyListIterator;
import org.apache.commons.collections4.iterators.EmptyMapIterator;
import org.apache.commons.collections4.iterators.EmptyOrderedIterator;
import org.apache.commons.collections4.iterators.EmptyOrderedMapIterator;
import org.apache.commons.collections4.iterators.EnumerationIterator;
import org.apache.commons.collections4.iterators.NodeListIterator;
import org.apache.commons.collections4.iterators.ObjectArrayIterator;
import org.apache.commons.collections4.iterators.ZippingIterator;
import org.apache.commons.collections4.map.EntrySetToMapIteratorAdapter;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

View File

@ -43,6 +43,7 @@ import java.util.ResourceBundle;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import org.apache.commons.collections4.collection.TransformedCollectionTest;
import org.apache.commons.collections4.keyvalue.DefaultKeyValue;
import org.apache.commons.collections4.keyvalue.DefaultMapEntry;
@ -166,7 +167,7 @@ public class MapUtilsTest {
() -> assertThrows(NullPointerException.class, () -> MapUtils.putAll(null, new Object[0]))
);
Map<String, String> test = MapUtils.putAll(new HashMap<String, String>(), new String[0]);
Map<String, String> test = MapUtils.putAll(new HashMap<String, String>(), org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY);
assertEquals(0, test.size());
// sub array

View File

@ -16,8 +16,8 @@
*/
package org.apache.commons.collections4;
import static org.apache.commons.collections4.functors.NullPredicate.*;
import static org.apache.commons.collections4.functors.TruePredicate.*;
import static org.apache.commons.collections4.functors.NullPredicate.nullPredicate;
import static org.apache.commons.collections4.functors.TruePredicate.truePredicate;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertSame;

View File

@ -16,6 +16,9 @@
*/
package org.apache.commons.collections4.bag;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
@ -32,11 +35,9 @@ import org.apache.commons.collections4.Bag;
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.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* Abstract test class for {@link org.apache.commons.collections4.Bag Bag} methods and contracts.
* <p>
@ -503,7 +504,7 @@ public abstract class AbstractBagTest<T> extends AbstractCollectionTest<T> {
bag.add((T) "B");
bag.add((T) "B");
bag.add((T) "C");
final String[] array = bag.toArray(new String[0]);
final String[] array = bag.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
int a = 0, b = 0, c = 0;
for (final String element : array) {
a += element.equals("A") ? 1 : 0;

View File

@ -16,10 +16,10 @@
*/
package org.apache.commons.collections4.bloomfilter;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.HashMap;
import java.util.Map;

View File

@ -22,6 +22,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Arrays;
import java.util.BitSet;
import java.util.function.IntPredicate;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

View File

@ -18,6 +18,7 @@ package org.apache.commons.collections4.bloomfilter;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
/**

View File

@ -16,13 +16,12 @@
*/
package org.apache.commons.collections4.bloomfilter;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Arrays;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;

View File

@ -39,6 +39,7 @@ import java.util.Objects;
import java.util.function.Predicate;
import org.apache.commons.collections4.AbstractObjectTest;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@ -1120,7 +1121,7 @@ public abstract class AbstractCollectionTest<E> extends AbstractObjectTest {
"toArray(null) should raise NPE");
verify();
array = getCollection().toArray(new Object[0]);
array = getCollection().toArray(ArrayUtils.EMPTY_OBJECT_ARRAY);
a = getCollection().toArray();
if ((getIterationBehaviour() & UNORDERED) != 0) {

View File

@ -16,6 +16,10 @@
*/
package org.apache.commons.collections4.collection;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@ -26,10 +30,6 @@ import org.apache.commons.collections4.Bag;
import org.apache.commons.collections4.Predicate;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests the PredicatedCollection.Builder class.
*

View File

@ -16,6 +16,10 @@
*/
package org.apache.commons.collections4.comparators;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
@ -23,10 +27,6 @@ import java.util.List;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* Tests for {@link BooleanComparator}.
*/

View File

@ -24,6 +24,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.jupiter.api.Test;
/**
@ -170,7 +171,7 @@ public class FixedOrderComparatorTest extends AbstractComparatorTest<String> {
assertEquals(FixedOrderComparator.UnknownObjectBehavior.BEFORE, comparator.getUnknownObjectBehavior());
LinkedList<String> keys = new LinkedList<>(Arrays.asList(topCities));
keys.addFirst("Minneapolis");
assertComparatorYieldsOrder(keys.toArray(new String[0]), comparator);
assertComparatorYieldsOrder(keys.toArray(ArrayUtils.EMPTY_STRING_ARRAY), comparator);
assertEquals(-1, comparator.compare("Minneapolis", "New York"));
assertEquals( 1, comparator.compare("New York", "Minneapolis"));
@ -180,7 +181,7 @@ public class FixedOrderComparatorTest extends AbstractComparatorTest<String> {
comparator.setUnknownObjectBehavior(FixedOrderComparator.UnknownObjectBehavior.AFTER);
keys = new LinkedList<>(Arrays.asList(topCities));
keys.add("Minneapolis");
assertComparatorYieldsOrder(keys.toArray(new String[0]), comparator);
assertComparatorYieldsOrder(keys.toArray(ArrayUtils.EMPTY_STRING_ARRAY), comparator);
assertEquals( 1, comparator.compare("Minneapolis", "New York"));
assertEquals(-1, comparator.compare("New York", "Minneapolis"));

View File

@ -16,15 +16,15 @@
*/
package org.apache.commons.collections4.functors;
import org.apache.commons.collections4.Predicate;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
import java.util.Collections;
import org.apache.commons.collections4.Predicate;
import org.junit.jupiter.api.Test;
/**
* Base class for tests of AnyPredicate, AllPredicate, and OnePredicate.
*

View File

@ -16,11 +16,11 @@
*/
package org.apache.commons.collections4.functors;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.apache.commons.collections4.Closure;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertNotNull;
public abstract class AbstractClosureTest {
@Test

View File

@ -16,6 +16,8 @@
*/
package org.apache.commons.collections4.functors;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@ -25,8 +27,6 @@ import org.apache.commons.collections4.Predicate;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* Base class for tests of composite predicates.
*

View File

@ -16,15 +16,16 @@
*/
package org.apache.commons.collections4.functors;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import java.util.ArrayList;
import java.util.List;
import static org.easymock.EasyMock.verify;
import static org.easymock.EasyMock.replay;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.AfterEach;
import org.apache.commons.collections4.Predicate;
import org.easymock.EasyMock;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
/**
* Base class for tests of predicates which delegate to other predicates when evaluating an object. This class

View File

@ -16,16 +16,16 @@
*/
package org.apache.commons.collections4.functors;
import org.apache.commons.collections4.Predicate;
import static org.apache.commons.collections4.functors.AllPredicate.allPredicate;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
import java.util.Collection;
import java.util.Collections;
import org.apache.commons.collections4.Predicate;
import org.junit.jupiter.api.Test;
/**
* Tests the org.apache.commons.collections.functors.AllPredicate class.
*

View File

@ -16,6 +16,10 @@
*/
package org.apache.commons.collections4.functors;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.DynamicTest.dynamicTest;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
@ -25,10 +29,6 @@ import org.apache.commons.collections4.FunctorException;
import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.TestFactory;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.DynamicTest.dynamicTest;
public class CatchAndRethrowClosureTest extends AbstractClosureTest {
private static <T> Closure<T> generateIOExceptionClosure() {

View File

@ -16,11 +16,12 @@
*/
package org.apache.commons.collections4.functors;
import static org.apache.commons.collections4.functors.ComparatorPredicate.*;
import static org.apache.commons.collections4.functors.ComparatorPredicate.comparatorPredicate;
import java.util.Comparator;
import org.apache.commons.collections4.Predicate;
import org.apache.commons.collections4.functors.ComparatorPredicate.Criterion;
import org.junit.jupiter.api.Test;

View File

@ -16,13 +16,13 @@
*/
package org.apache.commons.collections4.iterators;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Iterator;
import java.util.NoSuchElementException;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* Tests the ArrayIterator to ensure that the next() method will actually
* perform the iteration rather than the hasNext() method.

View File

@ -16,14 +16,14 @@
*/
package org.apache.commons.collections4.iterators;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.ListIterator;
import java.util.NoSuchElementException;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* Test the ArrayListIterator class.
*/

View File

@ -28,6 +28,7 @@ import java.util.NoSuchElementException;
import org.apache.commons.collections4.Predicate;
import org.apache.commons.collections4.functors.NotNullPredicate;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -105,7 +106,7 @@ public class FilterIteratorTest<E> extends AbstractIteratorTest<E> {
@Test
public void testReturnValues() {
verifyElementsInPredicate(new String[0]);
verifyElementsInPredicate(ArrayUtils.EMPTY_STRING_ARRAY);
verifyElementsInPredicate(new String[] { "a" });
verifyElementsInPredicate(new String[] { "b" });
verifyElementsInPredicate(new String[] { "c" });

View File

@ -16,6 +16,10 @@
*/
package org.apache.commons.collections4.iterators;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ -29,10 +33,6 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests the FilterListIterator class.
*

View File

@ -16,17 +16,17 @@
*/
package org.apache.commons.collections4.iterators;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Arrays;
import java.util.Iterator;
import java.util.NoSuchElementException;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests the IteratorEnumeration.
*/

View File

@ -16,6 +16,8 @@
*/
package org.apache.commons.collections4.iterators;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
@ -25,8 +27,6 @@ import org.apache.commons.collections4.ResettableListIterator;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* Tests the ListIteratorWrapper to ensure that it behaves as expected when wrapping a ListIterator.
*/

View File

@ -16,6 +16,11 @@
*/
package org.apache.commons.collections4.iterators;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -23,11 +28,6 @@ import java.util.NoSuchElementException;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests the LoopingIterator class.
*/

View File

@ -16,6 +16,12 @@
*/
package org.apache.commons.collections4.iterators;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -23,12 +29,6 @@ import java.util.NoSuchElementException;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests the LoopingListIterator class.
*/

View File

@ -16,7 +16,9 @@
*/
package org.apache.commons.collections4.iterators;
import static org.easymock.EasyMock.*;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Iterator;

View File

@ -16,14 +16,14 @@
*/
package org.apache.commons.collections4.iterators;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.ListIterator;
import java.util.NoSuchElementException;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* Tests the ObjectArrayListIterator class.
*/

View File

@ -16,6 +16,8 @@
*/
package org.apache.commons.collections4.iterators;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@ -26,8 +28,6 @@ import org.apache.commons.collections4.Unmodifiable;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* Tests the UnmodifiableListIterator.
*/

View File

@ -16,17 +16,17 @@
*/
package org.apache.commons.collections4.keyvalue;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.Test;
/**
* Abstract tests that can be extended to test any Map.Entry implementation.
* Subclasses must implement {@link #makeMapEntry(Object, Object)} to return

View File

@ -16,17 +16,16 @@
*/
package org.apache.commons.collections4.keyvalue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.HashMap;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
/**
* Test the DefaultKeyValue class.

View File

@ -16,13 +16,13 @@
*/
package org.apache.commons.collections4.keyvalue;
import static org.junit.jupiter.api.Assertions.assertSame;
import java.util.Map;
import org.apache.commons.collections4.KeyValue;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertSame;
/**
* Test the DefaultMapEntry class.
*

View File

@ -16,9 +16,15 @@
*/
package org.apache.commons.collections4.keyvalue;
import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestFactory;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNotSame;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.DynamicTest.dynamicTest;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@ -31,15 +37,9 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNotSame;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.DynamicTest.dynamicTest;
import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestFactory;
/**
* Unit tests for {@link org.apache.commons.collections4.keyvalue.MultiKey}.

View File

@ -16,12 +16,12 @@
*/
package org.apache.commons.collections4.keyvalue;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertSame;
import java.util.HashMap;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertSame;
import org.junit.jupiter.api.Test;
/**
* Test the TiedMapEntry class.

View File

@ -16,16 +16,16 @@
*/
package org.apache.commons.collections4.keyvalue;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Map;
import org.apache.commons.collections4.KeyValue;
import org.apache.commons.collections4.Unmodifiable;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Test the UnmodifiableMapEntry class.
*

View File

@ -21,8 +21,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
* Tests for COLLECTIONS-701.

View File

@ -29,6 +29,7 @@ import java.util.ListIterator;
import java.util.NoSuchElementException;
import org.apache.commons.collections4.BulkTest;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -1390,7 +1391,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
assertEquals("5", elts[4]);
assertEquals(5, elts.length);
final String[] elts2 = list.toArray(new String[0]);
final String[] elts2 = list.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
assertEquals("1", elts2[0]);
assertEquals("2", elts2[1]);
assertEquals("3", elts2[2]);
@ -1513,7 +1514,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
list.add(prefix + bulk + element);
list.add(prefix + bulk + bulk + element);
}
return list.toArray(new String[0]);
return list.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
}
@Override

View File

@ -26,8 +26,8 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import org.junit.jupiter.api.function.Executable;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;
/**
* Extension of {@link AbstractListTest} for exercising the {@link GrowthList}.

View File

@ -16,16 +16,16 @@
*/
package org.apache.commons.collections4.list;
import org.apache.commons.collections4.AbstractObjectTest;
import org.apache.commons.collections4.Factory;
import org.apache.commons.collections4.Transformer;
import org.junit.jupiter.api.Test;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.collections4.AbstractObjectTest;
import org.apache.commons.collections4.Factory;
import org.apache.commons.collections4.Transformer;
import org.junit.jupiter.api.Test;
public class LazyListTest extends AbstractObjectTest {
public LazyListTest() {

View File

@ -16,13 +16,21 @@
*/
package org.apache.commons.collections4.list;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Set;
import java.util.TreeSet;
import org.apache.commons.collections4.set.UnmodifiableSet;
import org.junit.jupiter.api.Test;
import java.util.*;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* JUnit tests.
*

View File

@ -18,9 +18,9 @@ package org.apache.commons.collections4.map;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

View File

@ -16,8 +16,8 @@
*/
package org.apache.commons.collections4.map;
import java.util.Map;
import java.util.Collection;
import java.util.Map;
/**
* This class is used in TestCompositeMap. When testing serialization,

View File

@ -16,7 +16,7 @@
*/
package org.apache.commons.collections4.map;
import static org.apache.commons.collections4.map.LazySortedMap.*;
import static org.apache.commons.collections4.map.LazySortedMap.lazySortedMap;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertThrows;

View File

@ -16,12 +16,12 @@
*/
package org.apache.commons.collections4.multimap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.HashMap;
import java.util.Arrays;
import java.util.ArrayList;
import org.apache.commons.collections4.BulkTest;
import org.apache.commons.collections4.ListValuedMap;

View File

@ -18,13 +18,13 @@ package org.apache.commons.collections4.multimap;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Set;
import java.util.Map;
import java.util.Map.Entry;
import java.util.HashMap;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.commons.collections4.BulkTest;
import org.apache.commons.collections4.MapIterator;

View File

@ -34,6 +34,7 @@ import org.apache.commons.collections4.BulkTest;
import org.apache.commons.collections4.MultiSet;
import org.apache.commons.collections4.collection.AbstractCollectionTest;
import org.apache.commons.collections4.set.AbstractSetTest;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.jupiter.api.Test;
/**
@ -517,7 +518,7 @@ public abstract class AbstractMultiSetTest<T> extends AbstractCollectionTest<T>
multiset.add((T) "B");
multiset.add((T) "B");
multiset.add((T) "C");
final String[] array = multiset.toArray(new String[0]);
final String[] array = multiset.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
int a = 0, b = 0, c = 0;
for (final String element : array) {
a += element.equals("A") ? 1 : 0;

View File

@ -16,6 +16,8 @@
*/
package org.apache.commons.collections4.properties;
import static org.junit.jupiter.params.provider.Arguments.arguments;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.nio.file.Files;
@ -24,15 +26,13 @@ import java.util.Properties;
import java.util.stream.Stream;
import org.apache.commons.collections4.BulkTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import static org.junit.jupiter.params.provider.Arguments.arguments;
public abstract class AbstractPropertiesFactoryTest<T extends Properties> {
public static Stream<Arguments> getParameters() {

View File

@ -35,6 +35,7 @@ import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Properties;
import org.apache.commons.io.input.NullReader;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.jupiter.api.Test;

View File

@ -19,8 +19,8 @@ package org.apache.commons.collections4.properties;
import java.util.Properties;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class PropertiesFactoryTest extends AbstractPropertiesFactoryTest<Properties> {

View File

@ -20,8 +20,8 @@ import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class SortedPropertiesTest {

View File

@ -16,6 +16,9 @@
*/
package org.apache.commons.collections4.sequence;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -25,9 +28,6 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class SequencesComparatorTest {
private List<String> before;

View File

@ -19,8 +19,8 @@ package org.apache.commons.collections4.set;
import java.util.Arrays;
import java.util.Collections;
import java.util.NavigableSet;
import java.util.TreeSet;
import java.util.Set;
import java.util.TreeSet;
import org.apache.commons.collections4.BulkTest;
import org.apache.commons.collections4.Transformer;

View File

@ -18,9 +18,9 @@ package org.apache.commons.collections4.set;
import java.util.Arrays;
import java.util.Collections;
import java.util.TreeSet;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import org.apache.commons.collections4.BulkTest;
import org.apache.commons.collections4.Transformer;

View File

@ -16,6 +16,8 @@
*/
package org.apache.commons.collections4.set;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
@ -26,8 +28,6 @@ import java.util.TreeSet;
import org.apache.commons.collections4.BulkTest;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* Extension of {@link AbstractNavigableSetTest} for exercising the
* {@link UnmodifiableNavigableSet} implementation.