package org.keyboardplaying.util;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

/**
 * Test class for the {@link BiHashMap}.
 *
 * @author Cyrille Chopelet (http://keyboardplaying.org)
 */
public class BiHashMapTest {

    /** Tests {@link BiHashMap#put(Object, Object)} and {@link BiHashMap#remove(Object)} (among other methods). */
    @Test
    public void testPutAndRemove() {
        BiHashMap<String, Integer> map = new BiHashMap<>();
        assertSize(0, map);

        map.put("A", 1);
        map.put("B", 2);
        assertTrue(map.containsKey("A"));
        assertSize(2, map);

        map.put("1", 1);
        assertFalse(map.containsKey("A"));
        assertTrue(map.containsValue(2));
        assertSize(2, map);

        map.removeValue(2);
        assertFalse(map.containsValue(2));
        assertSize(1, map);

        map.remove("1");
        assertSize(0, map);
    }

    private void assertSize(int expected, BiHashMap<String, Integer> map) {
        assertEquals(expected == 0, map.isEmpty());
        assertEquals(expected, map.size());
        assertEquals(expected, map.keySet().size());
        assertEquals(expected, map.values().size());
    }
}

@@ -158,20 +158,116 @@
 t.assert
-True
+Null;%0D%0Aimport static org.junit.Assert.assertTrue;%0D%0A%0D%0Aimport java.util.HashMap;%0D%0Aimport java.util.Map
 ;%0D%0A%0D%0Aimp
@@ -696,27 +696,80 @@
 %0D%0A%0D%0A        
-m
+M
 ap
+%3CString, Integer%3E all = new HashMap%3C%3E();%0D%0A        all
 .put(%22A%22, 1)
@@ -775,27 +775,27 @@
 );%0D%0A        
-map
+all
 .put(%22B%22, 2)
@@ -793,24 +793,52 @@
 t(%22B%22, 2);%0D%0A
+        map.putAll(all);%0D%0A%0D%0A
         asse
@@ -860,32 +860,203 @@
 ainsKey(%22A%22));%0D%0A
+        assertEquals(Integer.valueOf(1), map.get(%22A%22));%0D%0A        assertEquals(%22B%22, map.getKey(2));%0D%0A        assertNull(map.get(%22C%22));%0D%0A        assertNull(map.getKey(3));%0D%0A
         assertSi
@@ -1230,122 +1230,600 @@
 map.
-removeValue(2);%0D%0A        assertFalse(map.containsValue(2));%0D%0A        assertSize(1, map);%0D%0A%0D%0A        map.remove(%221%22
+put(%221%22, 0);%0D%0A        assertTrue(map.containsKey(%221%22));%0D%0A        assertFalse(map.containsValue(1));%0D%0A        assertTrue(map.containsValue(0));%0D%0A        assertSize(2, map);%0D%0A%0D%0A        map.removeValue(2);%0D%0A        assertFalse(map.containsValue(2));%0D%0A        assertSize(1, map);%0D%0A%0D%0A        map.remove(%221%22);%0D%0A        assertSize(0, map);%0D%0A    %7D%0D%0A%0D%0A    /** Tests %7B@link BiHashMap#clear()%7D. */%0D%0A    @Test%0D%0A    public void testClear() %7B%0D%0A        BiHashMap%3CString, Integer%3E map = new BiHashMap%3C%3E();%0D%0A        map.put(%22A%22, 1);%0D%0A        map.put(%22B%22, 2);%0D%0A        assertSize(2, map);%0D%0A%0D%0A        map.clear(
 );%0D%0A
@@ -2027,32 +2027,88 @@
 , map.size());%0D%0A
+        assertEquals(expected, map.entrySet().size());%0D%0A
         assertEq

Improve test coverage