added tests to make sure "youngest" promotion recognizes null values

in all cases


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130531 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Morgan James Delagrange 2002-02-15 21:08:38 +00:00
parent 1fe14f43e1
commit b688f162ac
1 changed files with 24 additions and 0 deletions

View File

@ -147,6 +147,30 @@ public class TestSequencedHashMap extends TestHashMap
} }
} }
public void testYoungest() {
labRat.put(new Integer(1),"foo");
labRat.put(new Integer(2),"bar");
assertTrue("first key is correct",labRat.get(0).equals(new Integer(1)));
labRat.put(new Integer(1),"boo");
assertTrue("second key is reassigned to first",labRat.get(0).equals(new Integer(2)));
}
public void testYoungestReplaceNullWithValue() {
labRat.put(new Integer(1),null);
labRat.put(new Integer(2),"foo");
assertTrue("first key is correct",labRat.get(0).equals(new Integer(1)));
labRat.put(new Integer(1),"bar");
assertTrue("second key is reassigned to first",labRat.get(0).equals(new Integer(2)));
}
public void testYoungestReplaceValueWithNull() {
labRat.put(new Integer(1),"bar");
labRat.put(new Integer(2),"foo");
assertTrue("first key is correct",labRat.get(0).equals(new Integer(1)));
labRat.put(new Integer(1),null);
assertTrue("second key is reassigned to first",labRat.get(0).equals(new Integer(2)));
}
protected void tearDown() { protected void tearDown() {
labRat = null; labRat = null;
} }