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:
Henri Yandell 2009-09-15 05:57:37 +00:00
parent 47abb18690
commit 68b5806258

View File

@ -16,8 +16,6 @@
*/ */
package org.apache.commons.collections.map; package org.apache.commons.collections.map;
import java.util.Map;
import junit.framework.Test; import junit.framework.Test;
import org.apache.commons.collections.BulkTest; import org.apache.commons.collections.BulkTest;
@ -30,7 +28,7 @@ import org.apache.commons.collections.BulkTest;
* *
* @author Michael A. Smith * @author Michael A. Smith
*/ */
public class TestStaticBucketMap extends AbstractTestMap { public class TestStaticBucketMap<K, V> extends AbstractTestIterableMap<K, V> {
public TestStaticBucketMap(String name) { public TestStaticBucketMap(String name) {
super(name); super(name);
@ -45,8 +43,16 @@ public class TestStaticBucketMap extends AbstractTestMap {
junit.textui.TestRunner.main(testCaseName); junit.textui.TestRunner.main(testCaseName);
} }
public Map makeEmptyMap() { public StaticBucketMap<K, V> makeObject() {
return new StaticBucketMap(30); return new StaticBucketMap<K, V>(30);
}
/**
* {@inheritDoc}
*/
@Override
public boolean isFailFastExpected() {
return false;
} }
public String[] ignoredTests() { public String[] ignoredTests() {
@ -60,9 +66,10 @@ public class TestStaticBucketMap extends AbstractTestMap {
} }
// Bugzilla 37567 // Bugzilla 37567
@SuppressWarnings("unchecked")
public void test_get_nullMatchesIncorrectly() { public void test_get_nullMatchesIncorrectly() {
StaticBucketMap map = new StaticBucketMap(17); StaticBucketMap<K, V> map = new StaticBucketMap<K, V>(17);
map.put(null, "A"); map.put(null, (V) "A");
assertEquals("A", map.get(null)); assertEquals("A", map.get(null));
// loop so we find a string that is in the same bucket as the null // loop so we find a string that is in the same bucket as the null
for (int i = 'A'; i <= 'Z'; i++) { for (int i = 'A'; i <= 'Z'; i++) {
@ -71,9 +78,10 @@ public class TestStaticBucketMap extends AbstractTestMap {
} }
} }
@SuppressWarnings("unchecked")
public void test_containsKey_nullMatchesIncorrectly() { public void test_containsKey_nullMatchesIncorrectly() {
StaticBucketMap map = new StaticBucketMap(17); StaticBucketMap<K, V> map = new StaticBucketMap<K, V>(17);
map.put(null, "A"); map.put(null, (V) "A");
assertEquals(true, map.containsKey(null)); assertEquals(true, map.containsKey(null));
// loop so we find a string that is in the same bucket as the null // loop so we find a string that is in the same bucket as the null
for (int i = 'A'; i <= 'Z'; i++) { for (int i = 'A'; i <= 'Z'; i++) {
@ -82,9 +90,10 @@ public class TestStaticBucketMap extends AbstractTestMap {
} }
} }
@SuppressWarnings("unchecked")
public void test_containsValue_nullMatchesIncorrectly() { public void test_containsValue_nullMatchesIncorrectly() {
StaticBucketMap map = new StaticBucketMap(17); StaticBucketMap<K, V> map = new StaticBucketMap<K, V>(17);
map.put("A", null); map.put((K) "A", null);
assertEquals(true, map.containsValue(null)); assertEquals(true, map.containsValue(null));
// loop so we find a string that is in the same bucket as the null // loop so we find a string that is in the same bucket as the null
for (int i = 'A'; i <= 'Z'; i++) { for (int i = 'A'; i <= 'Z'; i++) {