Merging from -r468106:814127 of collections_jdk5_branch - namely where this code was generified; mostly in r738956.
Also see the following revisions: ------------------------------------------------------------------------ r740150 | mbenson | 2009-02-02 15:24:00 -0800 (Mon, 02 Feb 2009) | 1 line make all [collections] maps implement IterableMap ------------------------------------------------------------------------ git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@815132 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
47abb18690
commit
68b5806258
|
@ -16,8 +16,6 @@
|
|||
*/
|
||||
package org.apache.commons.collections.map;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.apache.commons.collections.BulkTest;
|
||||
|
@ -30,7 +28,7 @@ import org.apache.commons.collections.BulkTest;
|
|||
*
|
||||
* @author Michael A. Smith
|
||||
*/
|
||||
public class TestStaticBucketMap extends AbstractTestMap {
|
||||
public class TestStaticBucketMap<K, V> extends AbstractTestIterableMap<K, V> {
|
||||
|
||||
public TestStaticBucketMap(String name) {
|
||||
super(name);
|
||||
|
@ -45,8 +43,16 @@ public class TestStaticBucketMap extends AbstractTestMap {
|
|||
junit.textui.TestRunner.main(testCaseName);
|
||||
}
|
||||
|
||||
public Map makeEmptyMap() {
|
||||
return new StaticBucketMap(30);
|
||||
public StaticBucketMap<K, V> makeObject() {
|
||||
return new StaticBucketMap<K, V>(30);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isFailFastExpected() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String[] ignoredTests() {
|
||||
|
@ -60,9 +66,10 @@ public class TestStaticBucketMap extends AbstractTestMap {
|
|||
}
|
||||
|
||||
// Bugzilla 37567
|
||||
@SuppressWarnings("unchecked")
|
||||
public void test_get_nullMatchesIncorrectly() {
|
||||
StaticBucketMap map = new StaticBucketMap(17);
|
||||
map.put(null, "A");
|
||||
StaticBucketMap<K, V> map = new StaticBucketMap<K, V>(17);
|
||||
map.put(null, (V) "A");
|
||||
assertEquals("A", map.get(null));
|
||||
// loop so we find a string that is in the same bucket as the null
|
||||
for (int i = 'A'; i <= 'Z'; i++) {
|
||||
|
@ -71,9 +78,10 @@ public class TestStaticBucketMap extends AbstractTestMap {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void test_containsKey_nullMatchesIncorrectly() {
|
||||
StaticBucketMap map = new StaticBucketMap(17);
|
||||
map.put(null, "A");
|
||||
StaticBucketMap<K, V> map = new StaticBucketMap<K, V>(17);
|
||||
map.put(null, (V) "A");
|
||||
assertEquals(true, map.containsKey(null));
|
||||
// loop so we find a string that is in the same bucket as the null
|
||||
for (int i = 'A'; i <= 'Z'; i++) {
|
||||
|
@ -82,9 +90,10 @@ public class TestStaticBucketMap extends AbstractTestMap {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void test_containsValue_nullMatchesIncorrectly() {
|
||||
StaticBucketMap map = new StaticBucketMap(17);
|
||||
map.put("A", null);
|
||||
StaticBucketMap<K, V> map = new StaticBucketMap<K, V>(17);
|
||||
map.put((K) "A", null);
|
||||
assertEquals(true, map.containsValue(null));
|
||||
// loop so we find a string that is in the same bucket as the null
|
||||
for (int i = 'A'; i <= 'Z'; i++) {
|
||||
|
|
Loading…
Reference in New Issue