Skip to content

Commit 06f66ed

Browse files
authored
Merge pull request eugenp#5258 from eugenp/bidimap-test
add bidimap key test
2 parents 7480bf1 + 8d65e26 commit 06f66ed

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎libraries/src/test/java/com/baeldung/commons/collections/BidiMapUnitTest.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,13 @@ public void givenValue_whenGetKey_thenMappedKey() {
4242
map.put("key1", "value1");
4343
assertEquals(map.getKey("value1"), "key1");
4444
}
45+
46+
@Test
47+
public void givenKeyValue_whenAddValue_thenReplaceFirstKey() {
48+
BidiMap<String, String> map = new DualHashBidiMap<>();
49+
map.put("key1", "value1");
50+
map.put("key2", "value1");
51+
assertEquals(map.size(), 1);
52+
assertFalse(map.containsKey("key1"));
53+
}
4554
}

0 commit comments

Comments
 (0)