This is an automated email from the ASF dual-hosted git repository. ggregory 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 7521b9ce2 Use generics to parameterize Map tests 7521b9ce2 is described below commit 7521b9ce2960d697fa452213ce250b5b99b4d57c Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Thu Oct 3 08:55:40 2024 -0400 Use generics to parameterize Map tests - More precise typing for Map tests - Helpful for testing BeanMap in Apache Commons BeanUtils - Javadoc --- .../apache/commons/collections4/AbstractTreeMapTest.java | 5 ++++- .../collections4/bidimap/AbstractSortedBidiMapTest.java | 6 +++--- .../map/AbstractConcurrentReferenceHashMapTest.java | 2 +- .../commons/collections4/map/AbstractIterableMapTest.java | 2 +- .../apache/commons/collections4/map/AbstractMapTest.java | 13 +++++++------ .../commons/collections4/map/AbstractSortedMapTest.java | 12 ++++++------ .../collections4/map/ConcurrentHashMapSanityTest.java | 5 ++--- .../map/ConcurrentReferenceHashMapDefaultsTest.java | 10 +++++++--- .../map/ConcurrentReferenceHashMapKSoftVSoftIdCTest.java | 10 +++++++--- .../map/ConcurrentReferenceHashMapKSoftVSoftTest.java | 10 +++++++--- .../map/ConcurrentReferenceHashMapKSoftVStrongIdCTest.java | 10 +++++++--- .../map/ConcurrentReferenceHashMapKSoftVStrongTest.java | 10 +++++++--- .../map/ConcurrentReferenceHashMapKSoftVWeakIdCTest.java | 10 +++++++--- .../map/ConcurrentReferenceHashMapKSoftVWeakTest.java | 10 +++++++--- .../map/ConcurrentReferenceHashMapKStrongVSoftIdCTest.java | 10 +++++++--- .../map/ConcurrentReferenceHashMapKStrongVSoftTest.java | 10 +++++++--- .../ConcurrentReferenceHashMapKStrongVStrongIdCTest.java | 10 +++++++--- .../map/ConcurrentReferenceHashMapKStrongVStrongTest.java | 10 +++++++--- .../map/ConcurrentReferenceHashMapKStrongVWeakIdCTest.java | 10 +++++++--- .../map/ConcurrentReferenceHashMapKStrongVWeakTest.java | 10 +++++++--- .../map/ConcurrentReferenceHashMapKWeakVSoftIdCTest.java | 10 +++++++--- .../map/ConcurrentReferenceHashMapKWeakVSoftTest.java | 10 +++++++--- .../map/ConcurrentReferenceHashMapKWeakVStrongIdCTest.java | 10 +++++++--- .../map/ConcurrentReferenceHashMapKWeakVStrongTest.java | 10 +++++++--- .../map/ConcurrentReferenceHashMapKWeakVWeakIdCTest.java | 10 +++++++--- .../map/ConcurrentReferenceHashMapKWeakVWeakTest.java | 10 +++++++--- .../apache/commons/collections4/map/HashMapSanityTest.java | 5 ++--- .../commons/collections4/map/PassiveExpiringMapTest.java | 4 ++-- .../collections4/multimap/AbstractMultiValuedMapTest.java | 2 +- 29 files changed, 162 insertions(+), 84 deletions(-) diff --git a/src/test/java/org/apache/commons/collections4/AbstractTreeMapTest.java b/src/test/java/org/apache/commons/collections4/AbstractTreeMapTest.java index f8296b0b6..3efd919ff 100644 --- a/src/test/java/org/apache/commons/collections4/AbstractTreeMapTest.java +++ b/src/test/java/org/apache/commons/collections4/AbstractTreeMapTest.java @@ -26,8 +26,11 @@ import org.junit.jupiter.api.Test; /** * Tests TreeMap. + * + * @param <K> the key type. + * @param <V> the value type. */ -public abstract class AbstractTreeMapTest<K, V> extends AbstractMapTest<K, V> { +public abstract class AbstractTreeMapTest<K, V> extends AbstractMapTest<TreeMap<K, V>, K, V> { public AbstractTreeMapTest(final String testName) { super(testName); diff --git a/src/test/java/org/apache/commons/collections4/bidimap/AbstractSortedBidiMapTest.java b/src/test/java/org/apache/commons/collections4/bidimap/AbstractSortedBidiMapTest.java index f11f8fc9c..5ce297ded 100644 --- a/src/test/java/org/apache/commons/collections4/bidimap/AbstractSortedBidiMapTest.java +++ b/src/test/java/org/apache/commons/collections4/bidimap/AbstractSortedBidiMapTest.java @@ -77,15 +77,15 @@ public abstract class AbstractSortedBidiMapTest<K extends Comparable<K>, V exten // } public BulkTest bulkTestHeadMap() { - return new AbstractSortedMapTest.TestHeadMap<>(this); + return new AbstractSortedMapTest.TestHeadMap<K, V>((AbstractBidiMapTest) this); } public BulkTest bulkTestSubMap() { - return new AbstractSortedMapTest.TestSubMap<>(this); + return new AbstractSortedMapTest.TestSubMap<>((AbstractBidiMapTest) this); } public BulkTest bulkTestTailMap() { - return new AbstractSortedMapTest.TestTailMap<>(this); + return new AbstractSortedMapTest.TestTailMap<>((AbstractBidiMapTest) this); } @Override diff --git a/src/test/java/org/apache/commons/collections4/map/AbstractConcurrentReferenceHashMapTest.java b/src/test/java/org/apache/commons/collections4/map/AbstractConcurrentReferenceHashMapTest.java index 97b57eb65..9d2d2e7a5 100644 --- a/src/test/java/org/apache/commons/collections4/map/AbstractConcurrentReferenceHashMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/AbstractConcurrentReferenceHashMapTest.java @@ -27,7 +27,7 @@ import org.apache.commons.collections4.map.ConcurrentReferenceHashMap.Option; * @param <K> the key type. * @param <V> the value type. */ -public abstract class AbstractConcurrentReferenceHashMapTest<K, V> extends AbstractMapTest<K, V> { +public abstract class AbstractConcurrentReferenceHashMapTest<K, V> extends AbstractMapTest<ConcurrentReferenceHashMap<K, V>, K, V> { protected static final EnumSet<Option> IDENTITY_COMPARISONS = EnumSet.of(Option.IDENTITY_COMPARISONS); 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 58e5038d3..e5ab73e36 100644 --- a/src/test/java/org/apache/commons/collections4/map/AbstractIterableMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/AbstractIterableMapTest.java @@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test; * @param <K> the key type. * @param <V> the value type. */ -public abstract class AbstractIterableMapTest<K, V> extends AbstractMapTest<K, V> { +public abstract class AbstractIterableMapTest<K, V> extends AbstractMapTest<IterableMap<K, V>, K, V> { public class InnerTestMapIterator extends AbstractMapIteratorTest<K, V> { public InnerTestMapIterator() { 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 919dc46b7..e2937e838 100644 --- a/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java @@ -132,10 +132,11 @@ import org.junit.jupiter.api.Test; * {@link #isAllowDuplicateValues()} and have it return {@code false} * </p> * + * @param <M> the Map type. * @param <K> the key type. * @param <V> the value type. */ -public abstract class AbstractMapTest<K, V> extends AbstractObjectTest { +public abstract class AbstractMapTest<M extends Map<K, V>, K, V> extends AbstractObjectTest { public class TestMapEntrySet extends AbstractSetTest<Map.Entry<K, V>> { public TestMapEntrySet() { @@ -514,7 +515,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest { } /** Map created by reset(). */ - protected Map<K, V> map; + protected M map; /** Entry set of map created by reset(). */ protected Set<Map.Entry<K, V>> entrySet; @@ -639,7 +640,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest { * * @return Map<K, V> */ - public Map<K, V> getMap() { + public M getMap() { return map; } @@ -877,8 +878,8 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest { * * @return the map to be tested */ - public Map<K, V> makeFullMap() { - final Map<K, V> m = makeObject(); + public M makeFullMap() { + final M m = makeObject(); addSampleMappings(m); return m; } @@ -889,7 +890,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest { * @return the map to be tested */ @Override - public abstract Map<K, V> makeObject(); + public abstract M makeObject(); /** * Resets the {@link #map}, {@link #entrySet}, {@link #keySet}, {@link #values} and {@link #confirmed} fields to empty. diff --git a/src/test/java/org/apache/commons/collections4/map/AbstractSortedMapTest.java b/src/test/java/org/apache/commons/collections4/map/AbstractSortedMapTest.java index 311c9880a..8b1e6a069 100644 --- a/src/test/java/org/apache/commons/collections4/map/AbstractSortedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/AbstractSortedMapTest.java @@ -36,13 +36,13 @@ import org.junit.jupiter.api.Test; * @param <K> the key type. * @param <V> the value type. */ -public abstract class AbstractSortedMapTest<K, V> extends AbstractMapTest<K, V> { +public abstract class AbstractSortedMapTest<K, V> extends AbstractMapTest<SortedMap<K, V>, K, V> { public static class TestHeadMap<K, V> extends TestViewMap<K, V> { static final int SUBSIZE = 6; final K toKey; - public TestHeadMap(final AbstractMapTest<K, V> main) { + public TestHeadMap(final AbstractMapTest<SortedMap<K, V>, K, V> main) { super("SortedMap.HeadMap", main); final Map<K, V> sm = main.makeFullMap(); for (final Entry<K, V> entry : sm.entrySet()) { @@ -98,7 +98,7 @@ public abstract class AbstractSortedMapTest<K, V> extends AbstractMapTest<K, V> final K fromKey; final K toKey; - public TestSubMap(final AbstractMapTest<K, V> main) { + public TestSubMap(final AbstractMapTest<SortedMap<K, V>, K, V> main) { super("SortedMap.SubMap", main); final Map<K, V> sm = main.makeFullMap(); for (final Entry<K, V> entry : sm.entrySet()) { @@ -161,7 +161,7 @@ public abstract class AbstractSortedMapTest<K, V> extends AbstractMapTest<K, V> final K fromKey; final K invalidKey; - public TestTailMap(final AbstractMapTest<K, V> main) { + public TestTailMap(final AbstractMapTest<SortedMap<K, V>, K, V> main) { super("SortedMap.TailMap", main); final Map<K, V> sm = main.makeFullMap(); for (final Entry<K, V> entry : sm.entrySet()) { @@ -214,12 +214,12 @@ public abstract class AbstractSortedMapTest<K, V> extends AbstractMapTest<K, V> } public abstract static class TestViewMap<K, V> extends AbstractSortedMapTest<K, V> { - protected final AbstractMapTest<K, V> main; + protected final AbstractMapTest<SortedMap<K, V>, K, V> main; protected final List<K> subSortedKeys = new ArrayList<>(); protected final List<V> subSortedValues = new ArrayList<>(); protected final List<V> subSortedNewValues = new ArrayList<>(); - public TestViewMap(final String name, final AbstractMapTest<K, V> main) { + public TestViewMap(final String name, final AbstractMapTest<SortedMap<K, V>, K, V> main) { super(name); this.main = main; } 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 f50dba71d..ab37a2dc4 100644 --- a/src/test/java/org/apache/commons/collections4/map/ConcurrentHashMapSanityTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ConcurrentHashMapSanityTest.java @@ -17,7 +17,6 @@ package org.apache.commons.collections4.map; -import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** @@ -26,7 +25,7 @@ import java.util.concurrent.ConcurrentHashMap; * @param <K> the key type. * @param <V> the value type. */ -public class ConcurrentHashMapSanityTest<K, V> extends AbstractMapTest<K, V> { +public class ConcurrentHashMapSanityTest<K, V> extends AbstractMapTest<ConcurrentHashMap<K, V>, K, V> { public ConcurrentHashMapSanityTest() { super(ConcurrentHashMapSanityTest.class.getSimpleName()); @@ -56,7 +55,7 @@ public class ConcurrentHashMapSanityTest<K, V> extends AbstractMapTest<K, V> { } @Override - public Map<K, V> makeObject() { + public ConcurrentHashMap<K, V> makeObject() { return new ConcurrentHashMap<>(); } diff --git a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapDefaultsTest.java b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapDefaultsTest.java index a1620b118..614cc7af8 100644 --- a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapDefaultsTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapDefaultsTest.java @@ -18,12 +18,16 @@ package org.apache.commons.collections4.map; -import java.util.Map; - +/** + * Tests {@link ConcurrentReferenceHashMap}. + * + * @param <K> the key type. + * @param <V> the value type. + */ public class ConcurrentReferenceHashMapDefaultsTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> { @Override - public Map<K, V> makeObject() { + public ConcurrentReferenceHashMap<K, V> makeObject() { // The default behavior return ConcurrentReferenceHashMap.<K, V>builder().get(); } diff --git a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVSoftIdCTest.java b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVSoftIdCTest.java index 5115dc3c2..727794e9a 100644 --- a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVSoftIdCTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVSoftIdCTest.java @@ -17,12 +17,16 @@ package org.apache.commons.collections4.map; -import java.util.Map; - +/** + * Tests {@link ConcurrentReferenceHashMap}. + * + * @param <K> the key type. + * @param <V> the value type. + */ public class ConcurrentReferenceHashMapKSoftVSoftIdCTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> { @Override - public Map<K, V> makeObject() { + public ConcurrentReferenceHashMap<K, V> makeObject() { // @formatter:off return ConcurrentReferenceHashMap.<K, V>builder() .softKeys() diff --git a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVSoftTest.java b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVSoftTest.java index e22ca32a6..fdcc4da67 100644 --- a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVSoftTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVSoftTest.java @@ -17,12 +17,16 @@ package org.apache.commons.collections4.map; -import java.util.Map; - +/** + * Tests {@link ConcurrentReferenceHashMap}. + * + * @param <K> the key type. + * @param <V> the value type. + */ public class ConcurrentReferenceHashMapKSoftVSoftTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> { @Override - public Map<K, V> makeObject() { + public ConcurrentReferenceHashMap<K, V> makeObject() { // @formatter:off return ConcurrentReferenceHashMap.<K, V>builder() .softKeys() diff --git a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVStrongIdCTest.java b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVStrongIdCTest.java index 6725a712b..33bd537aa 100644 --- a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVStrongIdCTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVStrongIdCTest.java @@ -17,12 +17,16 @@ package org.apache.commons.collections4.map; -import java.util.Map; - +/** + * Tests {@link ConcurrentReferenceHashMap}. + * + * @param <K> the key type. + * @param <V> the value type. + */ public class ConcurrentReferenceHashMapKSoftVStrongIdCTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> { @Override - public Map<K, V> makeObject() { + public ConcurrentReferenceHashMap<K, V> makeObject() { // @formatter:off return ConcurrentReferenceHashMap.<K, V>builder() .softKeys() diff --git a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVStrongTest.java b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVStrongTest.java index e42b78975..54f7e522e 100644 --- a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVStrongTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVStrongTest.java @@ -17,12 +17,16 @@ package org.apache.commons.collections4.map; -import java.util.Map; - +/** + * Tests {@link ConcurrentReferenceHashMap}. + * + * @param <K> the key type. + * @param <V> the value type. + */ public class ConcurrentReferenceHashMapKSoftVStrongTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> { @Override - public Map<K, V> makeObject() { + public ConcurrentReferenceHashMap<K, V> makeObject() { // @formatter:off return ConcurrentReferenceHashMap.<K, V>builder() .softKeys() diff --git a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVWeakIdCTest.java b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVWeakIdCTest.java index 90a29d02d..42c8a37f0 100644 --- a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVWeakIdCTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVWeakIdCTest.java @@ -17,12 +17,16 @@ package org.apache.commons.collections4.map; -import java.util.Map; - +/** + * Tests {@link ConcurrentReferenceHashMap}. + * + * @param <K> the key type. + * @param <V> the value type. + */ public class ConcurrentReferenceHashMapKSoftVWeakIdCTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> { @Override - public Map<K, V> makeObject() { + public ConcurrentReferenceHashMap<K, V> makeObject() { // @formatter:off return ConcurrentReferenceHashMap.<K, V>builder() .softKeys() diff --git a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVWeakTest.java b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVWeakTest.java index b53b2409e..532036574 100644 --- a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVWeakTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKSoftVWeakTest.java @@ -17,12 +17,16 @@ package org.apache.commons.collections4.map; -import java.util.Map; - +/** + * Tests {@link ConcurrentReferenceHashMap}. + * + * @param <K> the key type. + * @param <V> the value type. + */ public class ConcurrentReferenceHashMapKSoftVWeakTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> { @Override - public Map<K, V> makeObject() { + public ConcurrentReferenceHashMap<K, V> makeObject() { // @formatter:off return ConcurrentReferenceHashMap.<K, V>builder() .softKeys() diff --git a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVSoftIdCTest.java b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVSoftIdCTest.java index c824e6cea..6918a0e8d 100644 --- a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVSoftIdCTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVSoftIdCTest.java @@ -17,12 +17,16 @@ package org.apache.commons.collections4.map; -import java.util.Map; - +/** + * Tests {@link ConcurrentReferenceHashMap}. + * + * @param <K> the key type. + * @param <V> the value type. + */ public class ConcurrentReferenceHashMapKStrongVSoftIdCTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> { @Override - public Map<K, V> makeObject() { + public ConcurrentReferenceHashMap<K, V> makeObject() { // @formatter:off return ConcurrentReferenceHashMap.<K, V>builder() .strongKeys() diff --git a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVSoftTest.java b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVSoftTest.java index 2d6291273..a9df74cb4 100644 --- a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVSoftTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVSoftTest.java @@ -17,12 +17,16 @@ package org.apache.commons.collections4.map; -import java.util.Map; - +/** + * Tests {@link ConcurrentReferenceHashMap}. + * + * @param <K> the key type. + * @param <V> the value type. + */ public class ConcurrentReferenceHashMapKStrongVSoftTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> { @Override - public Map<K, V> makeObject() { + public ConcurrentReferenceHashMap<K, V> makeObject() { // @formatter:off return ConcurrentReferenceHashMap.<K, V>builder() .strongKeys() diff --git a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVStrongIdCTest.java b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVStrongIdCTest.java index 40c1fc019..04f1888df 100644 --- a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVStrongIdCTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVStrongIdCTest.java @@ -17,12 +17,16 @@ package org.apache.commons.collections4.map; -import java.util.Map; - +/** + * Tests {@link ConcurrentReferenceHashMap}. + * + * @param <K> the key type. + * @param <V> the value type. + */ public class ConcurrentReferenceHashMapKStrongVStrongIdCTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> { @Override - public Map<K, V> makeObject() { + public ConcurrentReferenceHashMap<K, V> makeObject() { // @formatter:off return ConcurrentReferenceHashMap.<K, V>builder() .strongKeys() diff --git a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVStrongTest.java b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVStrongTest.java index 49148901d..e1813c0b7 100644 --- a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVStrongTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVStrongTest.java @@ -17,12 +17,16 @@ package org.apache.commons.collections4.map; -import java.util.Map; - +/** + * Tests {@link ConcurrentReferenceHashMap}. + * + * @param <K> the key type. + * @param <V> the value type. + */ public class ConcurrentReferenceHashMapKStrongVStrongTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> { @Override - public Map<K, V> makeObject() { + public ConcurrentReferenceHashMap<K, V> makeObject() { // @formatter:off return ConcurrentReferenceHashMap.<K, V>builder() .strongKeys() diff --git a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVWeakIdCTest.java b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVWeakIdCTest.java index 9cb77a40f..e1de2d9c9 100644 --- a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVWeakIdCTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVWeakIdCTest.java @@ -17,12 +17,16 @@ package org.apache.commons.collections4.map; -import java.util.Map; - +/** + * Tests {@link ConcurrentReferenceHashMap}. + * + * @param <K> the key type. + * @param <V> the value type. + */ public class ConcurrentReferenceHashMapKStrongVWeakIdCTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> { @Override - public Map<K, V> makeObject() { + public ConcurrentReferenceHashMap<K, V> makeObject() { // @formatter:off return ConcurrentReferenceHashMap.<K, V>builder() .strongKeys() diff --git a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVWeakTest.java b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVWeakTest.java index b6c9abb92..cffc27d70 100644 --- a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVWeakTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKStrongVWeakTest.java @@ -17,12 +17,16 @@ package org.apache.commons.collections4.map; -import java.util.Map; - +/** + * Tests {@link ConcurrentReferenceHashMap}. + * + * @param <K> the key type. + * @param <V> the value type. + */ public class ConcurrentReferenceHashMapKStrongVWeakTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> { @Override - public Map<K, V> makeObject() { + public ConcurrentReferenceHashMap<K, V> makeObject() { // @formatter:off return ConcurrentReferenceHashMap.<K, V>builder() .strongKeys() diff --git a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVSoftIdCTest.java b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVSoftIdCTest.java index 8d3cb9b62..e8eed2d73 100644 --- a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVSoftIdCTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVSoftIdCTest.java @@ -17,12 +17,16 @@ package org.apache.commons.collections4.map; -import java.util.Map; - +/** + * Tests {@link ConcurrentReferenceHashMap}. + * + * @param <K> the key type. + * @param <V> the value type. + */ public class ConcurrentReferenceHashMapKWeakVSoftIdCTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> { @Override - public Map<K, V> makeObject() { + public ConcurrentReferenceHashMap<K, V> makeObject() { // @formatter:off return ConcurrentReferenceHashMap.<K, V>builder() .weakKeys() diff --git a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVSoftTest.java b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVSoftTest.java index 20ed8b865..6a6664b52 100644 --- a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVSoftTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVSoftTest.java @@ -17,12 +17,16 @@ package org.apache.commons.collections4.map; -import java.util.Map; - +/** + * Tests {@link ConcurrentReferenceHashMap}. + * + * @param <K> the key type. + * @param <V> the value type. + */ public class ConcurrentReferenceHashMapKWeakVSoftTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> { @Override - public Map<K, V> makeObject() { + public ConcurrentReferenceHashMap<K, V> makeObject() { // @formatter:off return ConcurrentReferenceHashMap.<K, V>builder() .weakKeys() diff --git a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVStrongIdCTest.java b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVStrongIdCTest.java index 3920af28a..bc708f2fb 100644 --- a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVStrongIdCTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVStrongIdCTest.java @@ -17,12 +17,16 @@ package org.apache.commons.collections4.map; -import java.util.Map; - +/** + * Tests {@link ConcurrentReferenceHashMap}. + * + * @param <K> the key type. + * @param <V> the value type. + */ public class ConcurrentReferenceHashMapKWeakVStrongIdCTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> { @Override - public Map<K, V> makeObject() { + public ConcurrentReferenceHashMap<K, V> makeObject() { // @formatter:off return ConcurrentReferenceHashMap.<K, V>builder() .weakKeys() diff --git a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVStrongTest.java b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVStrongTest.java index f8ae54b2b..c327cbbab 100644 --- a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVStrongTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVStrongTest.java @@ -17,12 +17,16 @@ package org.apache.commons.collections4.map; -import java.util.Map; - +/** + * Tests {@link ConcurrentReferenceHashMap}. + * + * @param <K> the key type. + * @param <V> the value type. + */ public class ConcurrentReferenceHashMapKWeakVStrongTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> { @Override - public Map<K, V> makeObject() { + public ConcurrentReferenceHashMap<K, V> makeObject() { // @formatter:off return ConcurrentReferenceHashMap.<K, V>builder() .weakKeys() diff --git a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVWeakIdCTest.java b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVWeakIdCTest.java index 7c7db04fe..19a9f722f 100644 --- a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVWeakIdCTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVWeakIdCTest.java @@ -17,12 +17,16 @@ package org.apache.commons.collections4.map; -import java.util.Map; - +/** + * Tests {@link ConcurrentReferenceHashMap}. + * + * @param <K> the key type. + * @param <V> the value type. + */ public class ConcurrentReferenceHashMapKWeakVWeakIdCTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> { @Override - public Map<K, V> makeObject() { + public ConcurrentReferenceHashMap<K, V> makeObject() { // @formatter:off return ConcurrentReferenceHashMap.<K, V>builder() .weakKeys() diff --git a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVWeakTest.java b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVWeakTest.java index 867ea2b69..024f2c9e3 100644 --- a/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVWeakTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMapKWeakVWeakTest.java @@ -17,12 +17,16 @@ package org.apache.commons.collections4.map; -import java.util.Map; - +/** + * Tests {@link ConcurrentReferenceHashMap}. + * + * @param <K> the key type. + * @param <V> the value type. + */ public class ConcurrentReferenceHashMapKWeakVWeakTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> { @Override - public Map<K, V> makeObject() { + public ConcurrentReferenceHashMap<K, V> makeObject() { // @formatter:off return ConcurrentReferenceHashMap.<K, V>builder() .weakKeys() diff --git a/src/test/java/org/apache/commons/collections4/map/HashMapSanityTest.java b/src/test/java/org/apache/commons/collections4/map/HashMapSanityTest.java index 4d4b55632..13b31308b 100644 --- a/src/test/java/org/apache/commons/collections4/map/HashMapSanityTest.java +++ b/src/test/java/org/apache/commons/collections4/map/HashMapSanityTest.java @@ -18,7 +18,6 @@ package org.apache.commons.collections4.map; import java.util.HashMap; -import java.util.Map; /** * A sanity test for the test framework. @@ -26,7 +25,7 @@ import java.util.Map; * @param <K> the key type. * @param <V> the value type. */ -public class HashMapSanityTest<K, V> extends AbstractMapTest<K, V> { +public class HashMapSanityTest<K, V> extends AbstractMapTest<HashMap<K, V>, K, V> { public HashMapSanityTest() { super(HashMapSanityTest.class.getSimpleName()); @@ -41,7 +40,7 @@ public class HashMapSanityTest<K, V> extends AbstractMapTest<K, V> { } @Override - public Map<K, V> makeObject() { + public HashMap<K, V> makeObject() { return new HashMap<>(); } diff --git a/src/test/java/org/apache/commons/collections4/map/PassiveExpiringMapTest.java b/src/test/java/org/apache/commons/collections4/map/PassiveExpiringMapTest.java index e6fa7ff6f..70fcafd86 100644 --- a/src/test/java/org/apache/commons/collections4/map/PassiveExpiringMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/PassiveExpiringMapTest.java @@ -39,7 +39,7 @@ import org.junit.jupiter.api.Test; * @param <K> the key type. * @param <V> the value type. */ -public class PassiveExpiringMapTest<K, V> extends AbstractMapTest<K, V> { +public class PassiveExpiringMapTest<K, V> extends AbstractMapTest<PassiveExpiringMap<K, V>, K, V> { private static final class TestExpirationPolicy implements ExpirationPolicy<Integer, String> { @@ -95,7 +95,7 @@ public class PassiveExpiringMapTest<K, V> extends AbstractMapTest<K, V> { } @Override - public Map<K, V> makeObject() { + public PassiveExpiringMap<K, V> makeObject() { return new PassiveExpiringMap<>(); } 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 b2905b98f..a5997e73d 100644 --- a/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java @@ -62,7 +62,7 @@ import org.junit.jupiter.api.Test; */ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTest { - public class TestMultiValuedMapAsMap extends AbstractMapTest<K, Collection<V>> { + public class TestMultiValuedMapAsMap extends AbstractMapTest<Map<K, Collection<V>>, K, Collection<V>> { public TestMultiValuedMapAsMap() { super(StringUtils.EMPTY);