Add code AbstractMultiValuedMapTest testPutAll_Map1,testPutAll_Map2 (#97)

This commit is contained in:
dota17 2019-10-30 21:18:37 +08:00 committed by Gary Gregory
parent 3d7f5ba67e
commit c4de02ddfc
1 changed files with 16 additions and 0 deletions

View File

@ -546,6 +546,14 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
test.put((K) "key", (V) "object0"); test.put((K) "key", (V) "object0");
test.putAll(original); test.putAll(original);
try {
final MultiValuedMap<K, V> originalNull = null;
test.putAll(originalNull);
fail("expecting NullPointerException");
} catch (final NullPointerException npe) {
// expected
}
assertEquals(2, test.keySet().size()); assertEquals(2, test.keySet().size());
assertEquals(4, test.size()); assertEquals(4, test.size());
assertEquals(1, test.get((K) "keyA").size()); assertEquals(1, test.get((K) "keyA").size());
@ -570,6 +578,14 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
test.put((K) "keyX", (V) "object0"); test.put((K) "keyX", (V) "object0");
test.putAll(original); test.putAll(original);
try {
final Map<K, V> originalNull = null;
test.putAll(originalNull);
fail("expecting NullPointerException");
} catch (final NullPointerException npe) {
// expected
}
assertEquals(3, test.keySet().size()); assertEquals(3, test.keySet().size());
assertEquals(4, test.size()); assertEquals(4, test.size());
assertEquals(1, test.get((K) "keyA").size()); assertEquals(1, test.get((K) "keyA").size());