Add tests for COLLECTIONS-474 - with null values and with non-null values

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1496168 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2013-06-24 19:16:42 +00:00
parent 74818aa847
commit 62e69cf4f2
1 changed files with 28 additions and 0 deletions

View File

@ -385,6 +385,34 @@ public class ListOrderedMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
}
}
public void testCOLLECTIONS_474_nullValues () {
Object key1 = new Object();
Object key2 = new Object();
HashMap<Object, Object> hmap = new HashMap<Object, Object>();
hmap.put(key1, null);
hmap.put(key2, null);
assertEquals("Should have two elements", 2, hmap.size());
ListOrderedMap<Object, Object> listMap = new ListOrderedMap<Object, Object>();
listMap.put(key1, null);
listMap.put(key2, null);
assertEquals("Should have two elements", 2, listMap.size());
listMap.putAll(2, hmap);
}
public void testCOLLECTIONS_474_nonNullValues () {
Object key1 = new Object();
Object key2 = new Object();
HashMap<Object, Object> hmap = new HashMap<Object, Object>();
hmap.put(key1, "1");
hmap.put(key2, "2");
assertEquals("Should have two elements", 2, hmap.size());
ListOrderedMap<Object, Object> listMap = new ListOrderedMap<Object, Object>();
listMap.put(key1, "3");
listMap.put(key2, "4");
assertEquals("Should have two elements", 2, listMap.size());
listMap.putAll(2, hmap);
}
//-----------------------------------------------------------------------
public BulkTest bulkTestKeyListView() {
return new TestKeyListView();