Add a test case AbstractMultiValuedMapTest testToString() (#100)
* Add a test case AbstractMultiValuedMapTest testToString() * Update a test case AbstractMultiValuedMapTest testToString()
This commit is contained in:
parent
ccb5e1a602
commit
455ebc0aec
|
@ -655,6 +655,33 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
|
|||
//assertEquals(new MultiValuedHashMap<K, V>(), map);
|
||||
}
|
||||
|
||||
public void testToString(){
|
||||
if (!isAddSupported()) {
|
||||
return;
|
||||
}
|
||||
final MultiValuedMap<K, V> map = makeObject();
|
||||
map.put((K) "A", (V) "X");
|
||||
map.put((K) "A", (V) "Y");
|
||||
map.put((K) "A", (V) "Z");
|
||||
map.put((K) "B", (V) "U");
|
||||
map.put((K) "B", (V) "V");
|
||||
map.put((K) "B", (V) "W");
|
||||
assertEquals("{A=[X, Y, Z], B=[U, V, W]}", map.toString());
|
||||
|
||||
try {
|
||||
final MultiValuedMap<K, V> originalNull = null;
|
||||
map.putAll(originalNull);
|
||||
fail("expecting NullPointerException");
|
||||
} catch (final NullPointerException npe) {
|
||||
// expected
|
||||
}
|
||||
assertEquals("{A=[X, Y, Z], B=[U, V, W]}", map.toString());
|
||||
|
||||
map.remove((K) "A");
|
||||
map.remove((K) "B");
|
||||
assertEquals("{}", map.toString());
|
||||
}
|
||||
|
||||
public void testKeysMultiSet() {
|
||||
final MultiValuedMap<K, V> map = makeFullMap();
|
||||
final MultiSet<K> keyMultiSet = map.keys();
|
||||
|
|
Loading…
Reference in New Issue