Updated WeakHashtable so that the null handling symantics match the superclass. Unit test contributed by Brian Stansberry.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@139057 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -153,6 +153,24 @@ public class WeakHashtableTest extends TestCase {
|
||||
weakHashtable.put(anotherKey, new Long(1066));
|
||||
|
||||
assertEquals(new Long(1066), weakHashtable.get(anotherKey));
|
||||
|
||||
// Test compliance with the hashtable API re nulls
|
||||
Exception caught = null;
|
||||
try {
|
||||
weakHashtable.put(null, new Object());
|
||||
}
|
||||
catch (Exception e) {
|
||||
caught = e;
|
||||
}
|
||||
assertNotNull("did not throw an exception adding a null key", caught);
|
||||
caught = null;
|
||||
try {
|
||||
weakHashtable.put(new Object(), null);
|
||||
}
|
||||
catch (Exception e) {
|
||||
caught = e;
|
||||
}
|
||||
assertNotNull("did not throw an exception adding a null value", caught);
|
||||
}
|
||||
|
||||
/** Tests public void putAll(MapÊt) */
|
||||
|
||||
Reference in New Issue
Block a user