Ensure that values returned are in same order as keys

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131305 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2003-10-31 01:25:24 +00:00
parent 27a4c25922
commit 2029f95ea2
1 changed files with 17 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/AbstractTestBidiMap.java,v 1.2 2003/10/29 00:06:25 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/AbstractTestBidiMap.java,v 1.3 2003/10/31 01:25:24 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -58,13 +58,14 @@
package org.apache.commons.collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
/**
* Abstract test class for {@link BidiMap} methods and contracts.
*
* @version $Revision: 1.2 $ $Date: 2003/10/29 00:06:25 $
* @version $Revision: 1.3 $ $Date: 2003/10/31 01:25:24 $
*
* @author Matthew Hawthorne
* @author Stephen Colebourne
@ -289,6 +290,20 @@ public abstract class AbstractTestBidiMap extends AbstractTestMap {
assertNull("Value was not removed.", map.getKey(value));
}
//-----------------------------------------------------------------------
public void testBidiKeySetValuesOrder() {
resetFull();
Iterator keys = map.keySet().iterator();
Iterator values = map.values().iterator();
for (; keys.hasNext() && values.hasNext();) {
Object key = keys.next();
Object value = values.next();
assertSame(map.get(key), value);
}
assertEquals(false, keys.hasNext());
assertEquals(false, values.hasNext());
}
//-----------------------------------------------------------------------
public void testBidiRemoveByKeySet() {
removeByKeySet(makeFullBidiMap(), entries[0][0], entries[0][1]);