This is an automated email from the ASF dual-hosted git repository.
garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git
The following commit(s) were added to refs/heads/master by this push:
new ac7e67cdf Fix Junit 5 nested tests (#681)
ac7e67cdf is described below
commit ac7e67cdf65bbe44d3a22587093de238e7eea2f0
Author: Gary Gregory <[email protected]>
AuthorDate: Sun Jun 14 15:20:54 2026 -0400
Fix Junit 5 nested tests (#681)
* Add back tests that were dropped porting to JUnit 5
* Sort members.
* Remove vertical whitespace
---
.../collections4/trie/UnmodifiableTrie.java | 3 +-
.../commons/collections4/bag/AbstractBagTest.java | 2 +
.../collections4/bidimap/AbstractBidiMapTest.java | 14 +++++--
.../bidimap/AbstractOrderedBidiMapTest.java | 2 +
.../iterators/AbstractMapIteratorTest.java | 9 +++-
.../collections4/list/AbstractListTest.java | 17 ++++++--
.../collections4/list/SetUniqueListTest.java | 11 +++++
.../collections4/map/AbstractIterableMapTest.java | 2 +
.../commons/collections4/map/AbstractMapTest.java | 49 +++++++++++++++-------
.../collections4/map/AbstractOrderedMapTest.java | 2 +
.../commons/collections4/map/CompositeMapTest.java | 5 +++
.../map/ConcurrentHashMapSanityTest.java | 5 +++
.../commons/collections4/map/Flat3MapTest.java | 2 +
.../commons/collections4/map/LinkedMapTest.java | 2 +
.../collections4/map/ListOrderedMap2Test.java | 2 +
.../collections4/map/ListOrderedMapTest.java | 3 ++
.../multimap/AbstractMultiValuedMapTest.java | 6 +++
.../multiset/AbstractMultiSetTest.java | 2 +
.../collections4/set/AbstractNavigableSetTest.java | 15 ++++---
.../collections4/set/AbstractSortedSetTest.java | 15 ++++---
.../collections4/trie/PatriciaTrieTest.java | 1 -
21 files changed, 132 insertions(+), 37 deletions(-)
diff --git
a/src/main/java/org/apache/commons/collections4/trie/UnmodifiableTrie.java
b/src/main/java/org/apache/commons/collections4/trie/UnmodifiableTrie.java
index 21424b5fd..3fcfc2d2f 100644
--- a/src/main/java/org/apache/commons/collections4/trie/UnmodifiableTrie.java
+++ b/src/main/java/org/apache/commons/collections4/trie/UnmodifiableTrie.java
@@ -29,6 +29,7 @@ import org.apache.commons.collections4.OrderedMapIterator;
import org.apache.commons.collections4.Trie;
import org.apache.commons.collections4.Unmodifiable;
import
org.apache.commons.collections4.iterators.UnmodifiableOrderedMapIterator;
+import org.apache.commons.collections4.map.UnmodifiableEntrySet;
/**
* An unmodifiable {@link Trie}.
@@ -99,7 +100,7 @@ public class UnmodifiableTrie<K, V> implements Trie<K, V>,
Serializable, Unmodif
@Override
public Set<Entry<K, V>> entrySet() {
- return Collections.unmodifiableSet(delegate.entrySet());
+ return UnmodifiableEntrySet.unmodifiableEntrySet(delegate.entrySet());
}
@Override
diff --git
a/src/test/java/org/apache/commons/collections4/bag/AbstractBagTest.java
b/src/test/java/org/apache/commons/collections4/bag/AbstractBagTest.java
index da0c49b31..eea933342 100644
--- a/src/test/java/org/apache/commons/collections4/bag/AbstractBagTest.java
+++ b/src/test/java/org/apache/commons/collections4/bag/AbstractBagTest.java
@@ -39,6 +39,7 @@ 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.Nested;
import org.junit.jupiter.api.Test;
/**
@@ -68,6 +69,7 @@ import org.junit.jupiter.api.Test;
*/
public abstract class AbstractBagTest<T> extends AbstractCollectionTest<T> {
+ @Nested
public class BagUniqueSetTest extends AbstractSetTest<T> {
@Override
diff --git
a/src/test/java/org/apache/commons/collections4/bidimap/AbstractBidiMapTest.java
b/src/test/java/org/apache/commons/collections4/bidimap/AbstractBidiMapTest.java
index 5cd60984a..e0afbbf71 100644
---
a/src/test/java/org/apache/commons/collections4/bidimap/AbstractBidiMapTest.java
+++
b/src/test/java/org/apache/commons/collections4/bidimap/AbstractBidiMapTest.java
@@ -36,6 +36,7 @@ import
org.apache.commons.collections4.collection.AbstractCollectionTest;
import org.apache.commons.collections4.iterators.AbstractMapIteratorTest;
import org.apache.commons.collections4.map.AbstractIterableMapTest;
import org.junit.jupiter.api.Assumptions;
+import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
/**
@@ -46,6 +47,7 @@ import org.junit.jupiter.api.Test;
*/
public abstract class AbstractBidiMapTest<K, V> extends
AbstractIterableMapTest<K, V> {
+ @Nested
public class BidiMapEntrySetTest extends MapEntrySetTest {
public BidiMapEntrySetTest() {
@@ -108,6 +110,7 @@ public abstract class AbstractBidiMapTest<K, V> extends
AbstractIterableMapTest<
}
+ @Nested
public class BidiMapIteratorTest extends AbstractMapIteratorTest<K, V> {
@Override
@@ -157,11 +160,15 @@ public abstract class AbstractBidiMapTest<K, V> extends
AbstractIterableMapTest<
}
- public class InverseBidiMapTest extends AbstractBidiMapTest<V, K> {
+ public abstract class InverseBidiMap extends AbstractBidiMapTest<V, K> {
final AbstractBidiMapTest<K, V> main;
- public InverseBidiMapTest(final AbstractBidiMapTest<K, V> main) {
+ public InverseBidiMap() {
+ this.main = AbstractBidiMapTest.this;
+ }
+
+ public InverseBidiMap(final AbstractBidiMapTest<K, V> main) {
this.main = main;
}
@@ -241,7 +248,8 @@ public abstract class AbstractBidiMapTest<K, V> extends
AbstractIterableMapTest<
}
public BulkTest bulkTestInverseMap() {
- return new InverseBidiMapTest(this);
+ return new InverseBidiMap(this) {
+ };
}
@Override
diff --git
a/src/test/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapTest.java
b/src/test/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapTest.java
index 0b87aa6a5..585089436 100644
---
a/src/test/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapTest.java
+++
b/src/test/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapTest.java
@@ -31,6 +31,7 @@ import org.apache.commons.collections4.BulkTest;
import org.apache.commons.collections4.MapIterator;
import org.apache.commons.collections4.OrderedBidiMap;
import org.apache.commons.collections4.iterators.AbstractMapIteratorTest;
+import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
/**
@@ -38,6 +39,7 @@ import org.junit.jupiter.api.Test;
*/
public abstract class AbstractOrderedBidiMapTest<K, V> extends
AbstractBidiMapTest<K, V> {
+ @Nested
public class BidiOrderedMapIteratorTest extends AbstractMapIteratorTest<K,
V> {
@Override
diff --git
a/src/test/java/org/apache/commons/collections4/iterators/AbstractMapIteratorTest.java
b/src/test/java/org/apache/commons/collections4/iterators/AbstractMapIteratorTest.java
index dbee0f67e..3a4820ee3 100644
---
a/src/test/java/org/apache/commons/collections4/iterators/AbstractMapIteratorTest.java
+++
b/src/test/java/org/apache/commons/collections4/iterators/AbstractMapIteratorTest.java
@@ -137,7 +137,12 @@ public abstract class AbstractMapIteratorTest<K, V>
extends AbstractIteratorTest
}
} else {
// setValue() should throw an IllegalStateException
- assertThrows(IllegalStateException.class, () ->
it.setValue(addSetValues()[0]));
+ try {
+ it.setValue(addSetValues()[0]);
+ fail();
+ } catch (final UnsupportedOperationException |
IllegalStateException ex) {
+ // ignore
+ }
}
}
@@ -295,7 +300,7 @@ public abstract class AbstractMapIteratorTest<K, V> extends
AbstractIteratorTest
assertFalse(map.containsKey(key));
verify();
// second remove fails
- assertThrows(NoSuchElementException.class, it::remove, "Full iterators
must have at least one element");
+ assertThrows(IllegalStateException.class, it::remove, "Full iterators
must have at least one element");
verify();
}
diff --git
a/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java
b/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java
index f1dad5c1b..f647650ef 100644
--- a/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java
+++ b/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java
@@ -131,11 +131,11 @@ public abstract class AbstractListTest<E> extends
AbstractCollectionTest<E> {
}
}
- public class ListIteratorTest extends AbstractListIteratorTest<E> {
+ public abstract class ListIteratorTest extends AbstractListIteratorTest<E>
{
@Override
public E addSetValue() {
- return getOtherElements()[0];
+ return getListIteratorAddSetValue();
}
@Override
@@ -162,7 +162,7 @@ public abstract class AbstractListTest<E> extends
AbstractCollectionTest<E> {
@Override
public boolean supportsSet() {
- return AbstractListTest.this.isSetSupported();
+ return isListIteratorSetSupported();
}
}
@@ -199,7 +199,8 @@ public abstract class AbstractListTest<E> extends
AbstractCollectionTest<E> {
}
public BulkTest bulkTestListIterator() {
- return new ListIteratorTest();
+ return new ListIteratorTest() {
+ };
}
/**
@@ -319,6 +320,10 @@ public abstract class AbstractListTest<E> extends
AbstractCollectionTest<E> {
return (List<E>) super.getConfirmed();
}
+ protected E getListIteratorAddSetValue() {
+ return getOtherElements()[0];
+ }
+
/**
* List equals method is defined.
*/
@@ -327,6 +332,10 @@ public abstract class AbstractListTest<E> extends
AbstractCollectionTest<E> {
return true;
}
+ protected boolean isListIteratorSetSupported() {
+ return isSetSupported();
+ }
+
/**
* Returns true if the collections produced by
* {@link #makeObject()} and {@link #makeFullCollection()}
diff --git
a/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java
b/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java
index 2a22a89c6..390b66de2 100644
--- a/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java
+++ b/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java
@@ -85,6 +85,17 @@ public class SetUniqueListTest<E> extends
AbstractListTest<E> {
};
}
+ @Override
+ @SuppressWarnings("unchecked")
+ protected E getListIteratorAddSetValue() {
+ return (E) Long.valueOf(1000);
+ }
+
+ @Override
+ protected boolean isListIteratorSetSupported() {
+ return false;
+ }
+
@Override
public List<E> makeObject() {
return new SetUniqueList<>(new ArrayList<>(), new HashSet<>());
diff --git
a/src/test/java/org/apache/commons/collections4/map/AbstractIterableMapTest.java
b/src/test/java/org/apache/commons/collections4/map/AbstractIterableMapTest.java
index 264806b6f..1e9db6f62 100644
---
a/src/test/java/org/apache/commons/collections4/map/AbstractIterableMapTest.java
+++
b/src/test/java/org/apache/commons/collections4/map/AbstractIterableMapTest.java
@@ -26,6 +26,7 @@ import org.apache.commons.collections4.BulkTest;
import org.apache.commons.collections4.IterableMap;
import org.apache.commons.collections4.MapIterator;
import org.apache.commons.collections4.iterators.AbstractMapIteratorTest;
+import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
/**
@@ -36,6 +37,7 @@ import org.junit.jupiter.api.Test;
*/
public abstract class AbstractIterableMapTest<K, V> extends
AbstractMapTest<IterableMap<K, V>, K, V> {
+ @Nested
public class InnerTestMapIterator extends AbstractMapIteratorTest<K, V> {
@Override
diff --git
a/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java
b/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java
index a75324e8f..24b589be7 100644
--- a/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java
@@ -50,6 +50,7 @@ import
org.apache.commons.collections4.collection.AbstractCollectionTest;
import org.apache.commons.collections4.keyvalue.DefaultMapEntry;
import org.apache.commons.collections4.set.AbstractSetTest;
import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
/**
@@ -138,7 +139,7 @@ import org.junit.jupiter.api.Test;
*/
public abstract class AbstractMapTest<M extends Map<K, V>, K, V> extends
AbstractObjectTest {
- public class MapEntrySetTest extends AbstractSetTest<Map.Entry<K, V>> {
+ public abstract class MapEntrySetTest extends AbstractSetTest<Map.Entry<K,
V>> {
@Override
public boolean areEqualElementsDistinguishable() {
@@ -198,8 +199,7 @@ public abstract class AbstractMapTest<M extends Map<K, V>,
K, V> extends Abstrac
@Override
public boolean isAddSupported() {
- // Collection views don't support add operations.
- return false;
+ return isEntrySetAddSupported();
}
public boolean isGetStructuralModify() {
@@ -323,6 +323,7 @@ public abstract class AbstractMapTest<M extends Map<K, V>,
K, V> extends Abstrac
}
}
+ @Nested
public class MapKeySetTest extends AbstractSetTest<K> {
@Override
@@ -400,7 +401,7 @@ public abstract class AbstractMapTest<M extends Map<K, V>,
K, V> extends Abstrac
// to the confirmed, that the already-constructed collection views
// are still equal to the confirmed's collection views.
- public class MapValuesTest extends AbstractCollectionTest<V> {
+ public abstract class MapValuesTest extends AbstractCollectionTest<V> {
@Override
public boolean areEqualElementsDistinguishable() {
@@ -436,7 +437,7 @@ public abstract class AbstractMapTest<M extends Map<K, V>,
K, V> extends Abstrac
@Override
public boolean isRemoveSupported() {
- return AbstractMapTest.this.isRemoveSupported();
+ return isValuesRemoveSupported();
}
@Override
@@ -555,7 +556,8 @@ public abstract class AbstractMapTest<M extends Map<K, V>,
K, V> extends Abstrac
* @return a {@link AbstractSetTest} instance for testing the map's entry
set
*/
public BulkTest bulkTestMapEntrySet() {
- return new MapEntrySetTest();
+ return new MapEntrySetTest() {
+ };
}
/**
@@ -575,7 +577,8 @@ public abstract class AbstractMapTest<M extends Map<K, V>,
K, V> extends Abstrac
* @return a {@link AbstractCollectionTest} instance for testing the map's
values collection
*/
public BulkTest bulkTestMapValues() {
- return new MapValuesTest();
+ return new MapValuesTest() {
+ };
}
/**
@@ -753,6 +756,15 @@ public abstract class AbstractMapTest<M extends Map<K, V>,
K, V> extends Abstrac
return true;
}
+ /**
+ * Returns true if the entry set view supports adding entries.
+ *
+ * @return false by default.
+ */
+ public boolean isEntrySetAddSupported() {
+ return false;
+ }
+
/**
* Returns true if the maps produced by {@link #makeObject()} and {@link
#makeFullMap()} provide fail-fast behavior on their various iterators.
* <p>
@@ -765,6 +777,11 @@ public abstract class AbstractMapTest<M extends Map<K, V>,
K, V> extends Abstrac
return true;
}
+ // tests begin here. Each test adds a little bit of tested functionality.
+ // Many methods assume previous methods passed. That is, they do not
+ // exhaustively recheck things that have already been checked in a previous
+ // test methods.
+
/**
* Returns true if the maps produced by {@link #makeObject()} and {@link
#makeFullMap()} can cause structural modification on a get(). The example is
* LRUMap.
@@ -778,11 +795,6 @@ public abstract class AbstractMapTest<M extends Map<K, V>,
K, V> extends Abstrac
return false;
}
- // tests begin here. Each test adds a little bit of tested functionality.
- // Many methods assume previous methods passed. That is, they do not
- // exhaustively recheck things that have already been checked in a previous
- // test methods.
-
protected boolean isLazyMapTest() {
return false;
}
@@ -858,6 +870,15 @@ public abstract class AbstractMapTest<M extends Map<K, V>,
K, V> extends Abstrac
return true;
}
+ /**
+ * Returns true if the values view supports removal operations.
+ *
+ * @return {@link #isRemoveSupported()} by default.
+ */
+ public boolean isValuesRemoveSupported() {
+ return isRemoveSupported();
+ }
+
/**
* Override to return a map other than HashMap as the confirmed map.
*
@@ -2240,7 +2261,7 @@ public abstract class AbstractMapTest<M extends Map<K,
V>, K, V> extends Abstrac
*/
@Test
void testReplaceKeyValue() {
- assumeTrue(isRemoveSupported());
+ assumeTrue(isPutChangeSupported());
resetFull();
final K[] sampleKeys = getSampleKeys();
final V[] sampleValues = getSampleValues();
@@ -2274,7 +2295,7 @@ public abstract class AbstractMapTest<M extends Map<K,
V>, K, V> extends Abstrac
*/
@Test
void testReplaceKeyValueValue() {
- assumeTrue(isRemoveSupported());
+ assumeTrue(isPutChangeSupported());
resetFull();
final K[] sampleKeys = getSampleKeys();
final V[] sampleValues = getSampleValues();
diff --git
a/src/test/java/org/apache/commons/collections4/map/AbstractOrderedMapTest.java
b/src/test/java/org/apache/commons/collections4/map/AbstractOrderedMapTest.java
index a5d2155ba..e2c82e086 100644
---
a/src/test/java/org/apache/commons/collections4/map/AbstractOrderedMapTest.java
+++
b/src/test/java/org/apache/commons/collections4/map/AbstractOrderedMapTest.java
@@ -34,6 +34,7 @@ import org.apache.commons.collections4.OrderedMap;
import org.apache.commons.collections4.OrderedMapIterator;
import org.apache.commons.collections4.comparators.NullComparator;
import
org.apache.commons.collections4.iterators.AbstractOrderedMapIteratorTest;
+import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
/**
@@ -44,6 +45,7 @@ import org.junit.jupiter.api.Test;
*/
public abstract class AbstractOrderedMapTest<K, V> extends
AbstractIterableMapTest<K, V> {
+ @Nested
public class InnerTestOrderedMapIterator extends
AbstractOrderedMapIteratorTest<K, V> {
@Override
diff --git
a/src/test/java/org/apache/commons/collections4/map/CompositeMapTest.java
b/src/test/java/org/apache/commons/collections4/map/CompositeMapTest.java
index 396f9eb7c..fbec8a01e 100644
--- a/src/test/java/org/apache/commons/collections4/map/CompositeMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/CompositeMapTest.java
@@ -60,6 +60,11 @@ public class CompositeMapTest<K, V> extends
AbstractIterableMapTest<K, V> {
return "4";
}
+ @Override
+ public boolean isValuesRemoveSupported() {
+ return false;
+ }
+
@Override
public CompositeMap<K, V> makeObject() {
final CompositeMap<K, V> map = new CompositeMap<>();
diff --git
a/src/test/java/org/apache/commons/collections4/map/ConcurrentHashMapSanityTest.java
b/src/test/java/org/apache/commons/collections4/map/ConcurrentHashMapSanityTest.java
index 1bfc15a2f..0b7ff805f 100644
---
a/src/test/java/org/apache/commons/collections4/map/ConcurrentHashMapSanityTest.java
+++
b/src/test/java/org/apache/commons/collections4/map/ConcurrentHashMapSanityTest.java
@@ -42,6 +42,11 @@ public class ConcurrentHashMapSanityTest<K, V> extends
AbstractMapTest<Concurren
return false;
}
+ @Override
+ public boolean isEntrySetAddSupported() {
+ return true;
+ }
+
/**
* Don't test, just a sanity check for the test framework.
*/
diff --git
a/src/test/java/org/apache/commons/collections4/map/Flat3MapTest.java
b/src/test/java/org/apache/commons/collections4/map/Flat3MapTest.java
index 1737d72bc..3db36c669 100644
--- a/src/test/java/org/apache/commons/collections4/map/Flat3MapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/Flat3MapTest.java
@@ -37,6 +37,7 @@ import org.apache.commons.collections4.BulkTest;
import org.apache.commons.collections4.IterableMap;
import org.apache.commons.collections4.MapIterator;
import org.apache.commons.collections4.iterators.AbstractMapIteratorTest;
+import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
/**
@@ -47,6 +48,7 @@ import org.junit.jupiter.api.Test;
*/
public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
+ @Nested
public class FlatMapIteratorTest extends AbstractMapIteratorTest<K, V> {
@Override
diff --git
a/src/test/java/org/apache/commons/collections4/map/LinkedMapTest.java
b/src/test/java/org/apache/commons/collections4/map/LinkedMapTest.java
index f77a24ce9..479fd5714 100644
--- a/src/test/java/org/apache/commons/collections4/map/LinkedMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/LinkedMapTest.java
@@ -31,6 +31,7 @@ import org.apache.commons.collections4.MapIterator;
import org.apache.commons.collections4.OrderedMap;
import org.apache.commons.collections4.ResettableIterator;
import org.apache.commons.collections4.list.AbstractListTest;
+import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
/**
@@ -41,6 +42,7 @@ import org.junit.jupiter.api.Test;
*/
public class LinkedMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
+ @Nested
public class ListViewTest extends AbstractListTest<K> {
@Override
diff --git
a/src/test/java/org/apache/commons/collections4/map/ListOrderedMap2Test.java
b/src/test/java/org/apache/commons/collections4/map/ListOrderedMap2Test.java
index 02a252cc6..8858c2eba 100644
--- a/src/test/java/org/apache/commons/collections4/map/ListOrderedMap2Test.java
+++ b/src/test/java/org/apache/commons/collections4/map/ListOrderedMap2Test.java
@@ -27,6 +27,7 @@ import java.util.List;
import org.apache.commons.collections4.BulkTest;
import org.apache.commons.collections4.MapIterator;
import org.apache.commons.collections4.list.AbstractListTest;
+import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
/**
@@ -37,6 +38,7 @@ import org.junit.jupiter.api.Test;
*/
public class ListOrderedMap2Test<K, V> extends AbstractOrderedMapTest<K, V> {
+ @Nested
public class ListViewTest extends AbstractListTest<K> {
@Override
diff --git
a/src/test/java/org/apache/commons/collections4/map/ListOrderedMapTest.java
b/src/test/java/org/apache/commons/collections4/map/ListOrderedMapTest.java
index 558cb3921..b9d504617 100644
--- a/src/test/java/org/apache/commons/collections4/map/ListOrderedMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/ListOrderedMapTest.java
@@ -31,6 +31,7 @@ import org.apache.commons.collections4.BulkTest;
import org.apache.commons.collections4.MapIterator;
import org.apache.commons.collections4.list.AbstractListTest;
import org.apache.commons.lang3.StringUtils;
+import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
/**
@@ -41,6 +42,7 @@ import org.junit.jupiter.api.Test;
*/
public class ListOrderedMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
+ @Nested
public class KeyListViewTest extends AbstractListTest<K> {
@Override
@@ -85,6 +87,7 @@ public class ListOrderedMapTest<K, V> extends
AbstractOrderedMapTest<K, V> {
}
+ @Nested
public class ValueListViewTest extends AbstractListTest<V> {
@Override
diff --git
a/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java
b/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java
index f6ec78ce0..8350701dc 100644
---
a/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java
+++
b/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java
@@ -50,6 +50,7 @@ import org.apache.commons.collections4.map.AbstractMapTest;
import org.apache.commons.collections4.multiset.AbstractMultiSetTest;
import org.apache.commons.collections4.set.AbstractSetTest;
import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
/**
@@ -64,6 +65,7 @@ import org.junit.jupiter.api.Test;
*/
public abstract class AbstractMultiValuedMapTest<K, V> extends
AbstractObjectTest {
+ @Nested
public class MultiValuedMapAsMapTest extends AbstractMapTest<Map<K,
Collection<V>>, K, Collection<V>> {
@Override
@@ -175,6 +177,7 @@ public abstract class AbstractMultiValuedMapTest<K, V>
extends AbstractObjectTes
}
}
+ @Nested
public class MultiValuedMapEntriesTest extends
AbstractCollectionTest<Entry<K, V>> {
@SuppressWarnings("unchecked")
@@ -247,6 +250,7 @@ public abstract class AbstractMultiValuedMapTest<K, V>
extends AbstractObjectTes
}
+ @Nested
public class MultiValuedMapKeySetTest extends AbstractSetTest<K> {
@SuppressWarnings("unchecked")
@@ -291,6 +295,7 @@ public abstract class AbstractMultiValuedMapTest<K, V>
extends AbstractObjectTes
}
}
+ @Nested
public class MultiValuedMapKeysTest extends AbstractMultiSetTest<K> {
@Override
@@ -348,6 +353,7 @@ public abstract class AbstractMultiValuedMapTest<K, V>
extends AbstractObjectTes
}
}
+ @Nested
public class MultiValuedMapValuesTest extends AbstractCollectionTest<V> {
@Override
diff --git
a/src/test/java/org/apache/commons/collections4/multiset/AbstractMultiSetTest.java
b/src/test/java/org/apache/commons/collections4/multiset/AbstractMultiSetTest.java
index 2d286d5c0..a4887c867 100644
---
a/src/test/java/org/apache/commons/collections4/multiset/AbstractMultiSetTest.java
+++
b/src/test/java/org/apache/commons/collections4/multiset/AbstractMultiSetTest.java
@@ -38,6 +38,7 @@ 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.Nested;
import org.junit.jupiter.api.Test;
/**
@@ -62,6 +63,7 @@ import org.junit.jupiter.api.Test;
*/
public abstract class AbstractMultiSetTest<T> extends
AbstractCollectionTest<T> {
+ @Nested
public class MultiSetUniqueSetTest extends AbstractSetTest<T> {
@Override
diff --git
a/src/test/java/org/apache/commons/collections4/set/AbstractNavigableSetTest.java
b/src/test/java/org/apache/commons/collections4/set/AbstractNavigableSetTest.java
index 9ca93f229..9ec3beba1 100644
---
a/src/test/java/org/apache/commons/collections4/set/AbstractNavigableSetTest.java
+++
b/src/test/java/org/apache/commons/collections4/set/AbstractNavigableSetTest.java
@@ -34,7 +34,7 @@ import org.apache.commons.collections4.BulkTest;
*/
public abstract class AbstractNavigableSetTest<E> extends
AbstractSortedSetTest<E> {
- public class NavigableSetSubSetTest extends AbstractNavigableSetTest<E> {
+ public abstract class NavigableSetSubSet extends
AbstractNavigableSetTest<E> {
static final int TYPE_SUBSET = 0;
static final int TYPE_TAILSET = 1;
@@ -49,7 +49,7 @@ public abstract class AbstractNavigableSetTest<E> extends
AbstractSortedSetTest<
private final boolean inclusive;
@SuppressWarnings("unchecked")
- public NavigableSetSubSetTest(final int bound, final boolean head,
final boolean inclusive) {
+ public NavigableSetSubSet(final int bound, final boolean head, final
boolean inclusive) {
if (head) {
this.type = TYPE_HEADSET;
this.inclusive = inclusive;
@@ -76,7 +76,7 @@ public abstract class AbstractNavigableSetTest<E> extends
AbstractSortedSetTest<
} //type
@SuppressWarnings("unchecked")
- public NavigableSetSubSetTest(final int loBound, final int hiBound,
final boolean inclusive) {
+ public NavigableSetSubSet(final int loBound, final int hiBound, final
boolean inclusive) {
this.type = TYPE_SUBSET;
this.lowBound = loBound;
this.highBound = hiBound;
@@ -188,7 +188,8 @@ public abstract class AbstractNavigableSetTest<E> extends
AbstractSortedSetTest<
final int loBound = length / 3;
final int hiBound = loBound * 2;
- return new NavigableSetSubSetTest(hiBound, true, true);
+ return new NavigableSetSubSet(hiBound, true, true) {
+ };
}
/**
@@ -204,7 +205,8 @@ public abstract class AbstractNavigableSetTest<E> extends
AbstractSortedSetTest<
final int loBound = length / 3;
final int hiBound = loBound * 2;
- return new NavigableSetSubSetTest(loBound, hiBound, false);
+ return new NavigableSetSubSet(loBound, hiBound, false) {
+ };
}
/**
@@ -218,7 +220,8 @@ public abstract class AbstractNavigableSetTest<E> extends
AbstractSortedSetTest<
public BulkTest bulkTestNavigableSetTailSet() {
final int length = getFullElements().length;
final int loBound = length / 3;
- return new NavigableSetSubSetTest(loBound, false, false);
+ return new NavigableSetSubSet(loBound, false, false) {
+ };
}
/**
diff --git
a/src/test/java/org/apache/commons/collections4/set/AbstractSortedSetTest.java
b/src/test/java/org/apache/commons/collections4/set/AbstractSortedSetTest.java
index 2ba54c057..69d2c7177 100644
---
a/src/test/java/org/apache/commons/collections4/set/AbstractSortedSetTest.java
+++
b/src/test/java/org/apache/commons/collections4/set/AbstractSortedSetTest.java
@@ -34,7 +34,7 @@ import org.apache.commons.collections4.BulkTest;
*/
public abstract class AbstractSortedSetTest<E> extends AbstractSetTest<E> {
- public class SortedSetSubSetTest extends AbstractSortedSetTest<E> {
+ public abstract class SortedSetSubSet extends AbstractSortedSetTest<E> {
static final int TYPE_SUBSET = 0;
static final int TYPE_TAILSET = 1;
@@ -48,7 +48,7 @@ public abstract class AbstractSortedSetTest<E> extends
AbstractSetTest<E> {
private final E[] otherElements;
@SuppressWarnings("unchecked")
- public SortedSetSubSetTest(final int bound, final boolean head) {
+ public SortedSetSubSet(final int bound, final boolean head) {
if (head) {
//System.out.println("HEADSET");
this.type = TYPE_HEADSET;
@@ -81,7 +81,7 @@ public abstract class AbstractSortedSetTest<E> extends
AbstractSetTest<E> {
} //type
@SuppressWarnings("unchecked")
- public SortedSetSubSetTest(final int loBound, final int hiBound) {
+ public SortedSetSubSet(final int loBound, final int hiBound) {
//System.out.println("SUBSET");
this.type = TYPE_SUBSET;
this.lowBound = loBound;
@@ -182,7 +182,8 @@ public abstract class AbstractSortedSetTest<E> extends
AbstractSetTest<E> {
final int loBound = length / 3;
final int hiBound = loBound * 2;
- return new SortedSetSubSetTest(hiBound, true);
+ return new SortedSetSubSet(hiBound, true) {
+ };
}
/**
@@ -198,7 +199,8 @@ public abstract class AbstractSortedSetTest<E> extends
AbstractSetTest<E> {
final int loBound = length / 3;
final int hiBound = loBound * 2;
- return new SortedSetSubSetTest(loBound, hiBound);
+ return new SortedSetSubSet(loBound, hiBound) {
+ };
}
@@ -213,7 +215,8 @@ public abstract class AbstractSortedSetTest<E> extends
AbstractSetTest<E> {
public BulkTest bulkTestSortedSetTailSet() {
final int length = getFullElements().length;
final int loBound = length / 3;
- return new SortedSetSubSetTest(loBound, false);
+ return new SortedSetSubSet(loBound, false) {
+ };
}
/**
diff --git
a/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java
b/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java
index 516e6d2bc..fca1dffd4 100644
--- a/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java
+++ b/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java
@@ -41,7 +41,6 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-
import org.apache.commons.collections4.Trie;
import org.apache.commons.collections4.map.AbstractSortedMapTest;
import org.apache.commons.lang3.StringUtils;