mirror of
https://github.com/apache/commons-collections.git
synced 2025-02-27 21:39:11 +00:00
Use generics to parameterize Map tests
- More precise typing for Map tests - Helpful for testing BeanMap in Apache Commons BeanUtils - Javadoc
This commit is contained in:
parent
7bc8ae8650
commit
7521b9ce29
@ -26,8 +26,11 @@ import org.junit.jupiter.api.Test;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests TreeMap.
|
* 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) {
|
public AbstractTreeMapTest(final String testName) {
|
||||||
super(testName);
|
super(testName);
|
||||||
|
@ -77,15 +77,15 @@ public abstract class AbstractSortedBidiMapTest<K extends Comparable<K>, V exten
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
public BulkTest bulkTestHeadMap() {
|
public BulkTest bulkTestHeadMap() {
|
||||||
return new AbstractSortedMapTest.TestHeadMap<>(this);
|
return new AbstractSortedMapTest.TestHeadMap<K, V>((AbstractBidiMapTest) this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BulkTest bulkTestSubMap() {
|
public BulkTest bulkTestSubMap() {
|
||||||
return new AbstractSortedMapTest.TestSubMap<>(this);
|
return new AbstractSortedMapTest.TestSubMap<>((AbstractBidiMapTest) this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BulkTest bulkTestTailMap() {
|
public BulkTest bulkTestTailMap() {
|
||||||
return new AbstractSortedMapTest.TestTailMap<>(this);
|
return new AbstractSortedMapTest.TestTailMap<>((AbstractBidiMapTest) this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -27,7 +27,7 @@ import org.apache.commons.collections4.map.ConcurrentReferenceHashMap.Option;
|
|||||||
* @param <K> the key type.
|
* @param <K> the key type.
|
||||||
* @param <V> the value 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);
|
protected static final EnumSet<Option> IDENTITY_COMPARISONS = EnumSet.of(Option.IDENTITY_COMPARISONS);
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
* @param <K> the key type.
|
* @param <K> the key type.
|
||||||
* @param <V> the value 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 class InnerTestMapIterator extends AbstractMapIteratorTest<K, V> {
|
||||||
public InnerTestMapIterator() {
|
public InnerTestMapIterator() {
|
||||||
|
@ -132,10 +132,11 @@ import org.junit.jupiter.api.Test;
|
|||||||
* {@link #isAllowDuplicateValues()} and have it return {@code false}
|
* {@link #isAllowDuplicateValues()} and have it return {@code false}
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
|
* @param <M> the Map type.
|
||||||
* @param <K> the key type.
|
* @param <K> the key type.
|
||||||
* @param <V> the value 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 class TestMapEntrySet extends AbstractSetTest<Map.Entry<K, V>> {
|
||||||
public TestMapEntrySet() {
|
public TestMapEntrySet() {
|
||||||
@ -514,7 +515,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Map created by reset(). */
|
/** Map created by reset(). */
|
||||||
protected Map<K, V> map;
|
protected M map;
|
||||||
|
|
||||||
/** Entry set of map created by reset(). */
|
/** Entry set of map created by reset(). */
|
||||||
protected Set<Map.Entry<K, V>> entrySet;
|
protected Set<Map.Entry<K, V>> entrySet;
|
||||||
@ -639,7 +640,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||||||
*
|
*
|
||||||
* @return Map<K, V>
|
* @return Map<K, V>
|
||||||
*/
|
*/
|
||||||
public Map<K, V> getMap() {
|
public M getMap() {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -877,8 +878,8 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||||||
*
|
*
|
||||||
* @return the map to be tested
|
* @return the map to be tested
|
||||||
*/
|
*/
|
||||||
public Map<K, V> makeFullMap() {
|
public M makeFullMap() {
|
||||||
final Map<K, V> m = makeObject();
|
final M m = makeObject();
|
||||||
addSampleMappings(m);
|
addSampleMappings(m);
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
@ -889,7 +890,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||||||
* @return the map to be tested
|
* @return the map to be tested
|
||||||
*/
|
*/
|
||||||
@Override
|
@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.
|
* Resets the {@link #map}, {@link #entrySet}, {@link #keySet}, {@link #values} and {@link #confirmed} fields to empty.
|
||||||
|
@ -36,13 +36,13 @@ import org.junit.jupiter.api.Test;
|
|||||||
* @param <K> the key type.
|
* @param <K> the key type.
|
||||||
* @param <V> the value 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> {
|
public static class TestHeadMap<K, V> extends TestViewMap<K, V> {
|
||||||
static final int SUBSIZE = 6;
|
static final int SUBSIZE = 6;
|
||||||
final K toKey;
|
final K toKey;
|
||||||
|
|
||||||
public TestHeadMap(final AbstractMapTest<K, V> main) {
|
public TestHeadMap(final AbstractMapTest<SortedMap<K, V>, K, V> main) {
|
||||||
super("SortedMap.HeadMap", main);
|
super("SortedMap.HeadMap", main);
|
||||||
final Map<K, V> sm = main.makeFullMap();
|
final Map<K, V> sm = main.makeFullMap();
|
||||||
for (final Entry<K, V> entry : sm.entrySet()) {
|
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 fromKey;
|
||||||
final K toKey;
|
final K toKey;
|
||||||
|
|
||||||
public TestSubMap(final AbstractMapTest<K, V> main) {
|
public TestSubMap(final AbstractMapTest<SortedMap<K, V>, K, V> main) {
|
||||||
super("SortedMap.SubMap", main);
|
super("SortedMap.SubMap", main);
|
||||||
final Map<K, V> sm = main.makeFullMap();
|
final Map<K, V> sm = main.makeFullMap();
|
||||||
for (final Entry<K, V> entry : sm.entrySet()) {
|
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 fromKey;
|
||||||
final K invalidKey;
|
final K invalidKey;
|
||||||
|
|
||||||
public TestTailMap(final AbstractMapTest<K, V> main) {
|
public TestTailMap(final AbstractMapTest<SortedMap<K, V>, K, V> main) {
|
||||||
super("SortedMap.TailMap", main);
|
super("SortedMap.TailMap", main);
|
||||||
final Map<K, V> sm = main.makeFullMap();
|
final Map<K, V> sm = main.makeFullMap();
|
||||||
for (final Entry<K, V> entry : sm.entrySet()) {
|
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> {
|
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<K> subSortedKeys = new ArrayList<>();
|
||||||
protected final List<V> subSortedValues = new ArrayList<>();
|
protected final List<V> subSortedValues = new ArrayList<>();
|
||||||
protected final List<V> subSortedNewValues = 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);
|
super(name);
|
||||||
this.main = main;
|
this.main = main;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
package org.apache.commons.collections4.map;
|
package org.apache.commons.collections4.map;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,7 +25,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
* @param <K> the key type.
|
* @param <K> the key type.
|
||||||
* @param <V> the value 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() {
|
public ConcurrentHashMapSanityTest() {
|
||||||
super(ConcurrentHashMapSanityTest.class.getSimpleName());
|
super(ConcurrentHashMapSanityTest.class.getSimpleName());
|
||||||
@ -56,7 +55,7 @@ public class ConcurrentHashMapSanityTest<K, V> extends AbstractMapTest<K, V> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public ConcurrentHashMap<K, V> makeObject() {
|
||||||
return new ConcurrentHashMap<>();
|
return new ConcurrentHashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,12 +18,16 @@
|
|||||||
|
|
||||||
package org.apache.commons.collections4.map;
|
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> {
|
public class ConcurrentReferenceHashMapDefaultsTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public ConcurrentReferenceHashMap<K, V> makeObject() {
|
||||||
// The default behavior
|
// The default behavior
|
||||||
return ConcurrentReferenceHashMap.<K, V>builder().get();
|
return ConcurrentReferenceHashMap.<K, V>builder().get();
|
||||||
}
|
}
|
||||||
|
@ -17,12 +17,16 @@
|
|||||||
|
|
||||||
package org.apache.commons.collections4.map;
|
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> {
|
public class ConcurrentReferenceHashMapKSoftVSoftIdCTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public ConcurrentReferenceHashMap<K, V> makeObject() {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
return ConcurrentReferenceHashMap.<K, V>builder()
|
return ConcurrentReferenceHashMap.<K, V>builder()
|
||||||
.softKeys()
|
.softKeys()
|
||||||
|
@ -17,12 +17,16 @@
|
|||||||
|
|
||||||
package org.apache.commons.collections4.map;
|
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> {
|
public class ConcurrentReferenceHashMapKSoftVSoftTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public ConcurrentReferenceHashMap<K, V> makeObject() {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
return ConcurrentReferenceHashMap.<K, V>builder()
|
return ConcurrentReferenceHashMap.<K, V>builder()
|
||||||
.softKeys()
|
.softKeys()
|
||||||
|
@ -17,12 +17,16 @@
|
|||||||
|
|
||||||
package org.apache.commons.collections4.map;
|
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> {
|
public class ConcurrentReferenceHashMapKSoftVStrongIdCTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public ConcurrentReferenceHashMap<K, V> makeObject() {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
return ConcurrentReferenceHashMap.<K, V>builder()
|
return ConcurrentReferenceHashMap.<K, V>builder()
|
||||||
.softKeys()
|
.softKeys()
|
||||||
|
@ -17,12 +17,16 @@
|
|||||||
|
|
||||||
package org.apache.commons.collections4.map;
|
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> {
|
public class ConcurrentReferenceHashMapKSoftVStrongTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public ConcurrentReferenceHashMap<K, V> makeObject() {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
return ConcurrentReferenceHashMap.<K, V>builder()
|
return ConcurrentReferenceHashMap.<K, V>builder()
|
||||||
.softKeys()
|
.softKeys()
|
||||||
|
@ -17,12 +17,16 @@
|
|||||||
|
|
||||||
package org.apache.commons.collections4.map;
|
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> {
|
public class ConcurrentReferenceHashMapKSoftVWeakIdCTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public ConcurrentReferenceHashMap<K, V> makeObject() {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
return ConcurrentReferenceHashMap.<K, V>builder()
|
return ConcurrentReferenceHashMap.<K, V>builder()
|
||||||
.softKeys()
|
.softKeys()
|
||||||
|
@ -17,12 +17,16 @@
|
|||||||
|
|
||||||
package org.apache.commons.collections4.map;
|
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> {
|
public class ConcurrentReferenceHashMapKSoftVWeakTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public ConcurrentReferenceHashMap<K, V> makeObject() {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
return ConcurrentReferenceHashMap.<K, V>builder()
|
return ConcurrentReferenceHashMap.<K, V>builder()
|
||||||
.softKeys()
|
.softKeys()
|
||||||
|
@ -17,12 +17,16 @@
|
|||||||
|
|
||||||
package org.apache.commons.collections4.map;
|
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> {
|
public class ConcurrentReferenceHashMapKStrongVSoftIdCTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public ConcurrentReferenceHashMap<K, V> makeObject() {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
return ConcurrentReferenceHashMap.<K, V>builder()
|
return ConcurrentReferenceHashMap.<K, V>builder()
|
||||||
.strongKeys()
|
.strongKeys()
|
||||||
|
@ -17,12 +17,16 @@
|
|||||||
|
|
||||||
package org.apache.commons.collections4.map;
|
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> {
|
public class ConcurrentReferenceHashMapKStrongVSoftTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public ConcurrentReferenceHashMap<K, V> makeObject() {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
return ConcurrentReferenceHashMap.<K, V>builder()
|
return ConcurrentReferenceHashMap.<K, V>builder()
|
||||||
.strongKeys()
|
.strongKeys()
|
||||||
|
@ -17,12 +17,16 @@
|
|||||||
|
|
||||||
package org.apache.commons.collections4.map;
|
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> {
|
public class ConcurrentReferenceHashMapKStrongVStrongIdCTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public ConcurrentReferenceHashMap<K, V> makeObject() {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
return ConcurrentReferenceHashMap.<K, V>builder()
|
return ConcurrentReferenceHashMap.<K, V>builder()
|
||||||
.strongKeys()
|
.strongKeys()
|
||||||
|
@ -17,12 +17,16 @@
|
|||||||
|
|
||||||
package org.apache.commons.collections4.map;
|
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> {
|
public class ConcurrentReferenceHashMapKStrongVStrongTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public ConcurrentReferenceHashMap<K, V> makeObject() {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
return ConcurrentReferenceHashMap.<K, V>builder()
|
return ConcurrentReferenceHashMap.<K, V>builder()
|
||||||
.strongKeys()
|
.strongKeys()
|
||||||
|
@ -17,12 +17,16 @@
|
|||||||
|
|
||||||
package org.apache.commons.collections4.map;
|
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> {
|
public class ConcurrentReferenceHashMapKStrongVWeakIdCTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public ConcurrentReferenceHashMap<K, V> makeObject() {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
return ConcurrentReferenceHashMap.<K, V>builder()
|
return ConcurrentReferenceHashMap.<K, V>builder()
|
||||||
.strongKeys()
|
.strongKeys()
|
||||||
|
@ -17,12 +17,16 @@
|
|||||||
|
|
||||||
package org.apache.commons.collections4.map;
|
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> {
|
public class ConcurrentReferenceHashMapKStrongVWeakTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public ConcurrentReferenceHashMap<K, V> makeObject() {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
return ConcurrentReferenceHashMap.<K, V>builder()
|
return ConcurrentReferenceHashMap.<K, V>builder()
|
||||||
.strongKeys()
|
.strongKeys()
|
||||||
|
@ -17,12 +17,16 @@
|
|||||||
|
|
||||||
package org.apache.commons.collections4.map;
|
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> {
|
public class ConcurrentReferenceHashMapKWeakVSoftIdCTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public ConcurrentReferenceHashMap<K, V> makeObject() {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
return ConcurrentReferenceHashMap.<K, V>builder()
|
return ConcurrentReferenceHashMap.<K, V>builder()
|
||||||
.weakKeys()
|
.weakKeys()
|
||||||
|
@ -17,12 +17,16 @@
|
|||||||
|
|
||||||
package org.apache.commons.collections4.map;
|
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> {
|
public class ConcurrentReferenceHashMapKWeakVSoftTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public ConcurrentReferenceHashMap<K, V> makeObject() {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
return ConcurrentReferenceHashMap.<K, V>builder()
|
return ConcurrentReferenceHashMap.<K, V>builder()
|
||||||
.weakKeys()
|
.weakKeys()
|
||||||
|
@ -17,12 +17,16 @@
|
|||||||
|
|
||||||
package org.apache.commons.collections4.map;
|
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> {
|
public class ConcurrentReferenceHashMapKWeakVStrongIdCTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public ConcurrentReferenceHashMap<K, V> makeObject() {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
return ConcurrentReferenceHashMap.<K, V>builder()
|
return ConcurrentReferenceHashMap.<K, V>builder()
|
||||||
.weakKeys()
|
.weakKeys()
|
||||||
|
@ -17,12 +17,16 @@
|
|||||||
|
|
||||||
package org.apache.commons.collections4.map;
|
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> {
|
public class ConcurrentReferenceHashMapKWeakVStrongTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public ConcurrentReferenceHashMap<K, V> makeObject() {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
return ConcurrentReferenceHashMap.<K, V>builder()
|
return ConcurrentReferenceHashMap.<K, V>builder()
|
||||||
.weakKeys()
|
.weakKeys()
|
||||||
|
@ -17,12 +17,16 @@
|
|||||||
|
|
||||||
package org.apache.commons.collections4.map;
|
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> {
|
public class ConcurrentReferenceHashMapKWeakVWeakIdCTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public ConcurrentReferenceHashMap<K, V> makeObject() {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
return ConcurrentReferenceHashMap.<K, V>builder()
|
return ConcurrentReferenceHashMap.<K, V>builder()
|
||||||
.weakKeys()
|
.weakKeys()
|
||||||
|
@ -17,12 +17,16 @@
|
|||||||
|
|
||||||
package org.apache.commons.collections4.map;
|
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> {
|
public class ConcurrentReferenceHashMapKWeakVWeakTest<K, V> extends AbstractConcurrentReferenceHashMapTest<K, V> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public ConcurrentReferenceHashMap<K, V> makeObject() {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
return ConcurrentReferenceHashMap.<K, V>builder()
|
return ConcurrentReferenceHashMap.<K, V>builder()
|
||||||
.weakKeys()
|
.weakKeys()
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
package org.apache.commons.collections4.map;
|
package org.apache.commons.collections4.map;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A sanity test for the test framework.
|
* A sanity test for the test framework.
|
||||||
@ -26,7 +25,7 @@ import java.util.Map;
|
|||||||
* @param <K> the key type.
|
* @param <K> the key type.
|
||||||
* @param <V> the value 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() {
|
public HashMapSanityTest() {
|
||||||
super(HashMapSanityTest.class.getSimpleName());
|
super(HashMapSanityTest.class.getSimpleName());
|
||||||
@ -41,7 +40,7 @@ public class HashMapSanityTest<K, V> extends AbstractMapTest<K, V> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public HashMap<K, V> makeObject() {
|
||||||
return new HashMap<>();
|
return new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
* @param <K> the key type.
|
* @param <K> the key type.
|
||||||
* @param <V> the value 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
|
private static final class TestExpirationPolicy
|
||||||
implements ExpirationPolicy<Integer, String> {
|
implements ExpirationPolicy<Integer, String> {
|
||||||
@ -95,7 +95,7 @@ public class PassiveExpiringMapTest<K, V> extends AbstractMapTest<K, V> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<K, V> makeObject() {
|
public PassiveExpiringMap<K, V> makeObject() {
|
||||||
return new PassiveExpiringMap<>();
|
return new PassiveExpiringMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
*/
|
*/
|
||||||
public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTest {
|
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() {
|
public TestMultiValuedMapAsMap() {
|
||||||
super(StringUtils.EMPTY);
|
super(StringUtils.EMPTY);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user