@Test public void put_get() throws Exception { final StringKeyObjectMap<Integer> map = new StringKeyObjectMap<Integer>(); Assert.assertNull(map.get("abc")); map.put("abc", Integer.valueOf(0)); Assert.assertEquals(Integer.valueOf(0), map.get("abc")); }
@Test public void size() throws Exception { final StringKeyObjectMap<Integer> map = new StringKeyObjectMap<Integer>(); Assert.assertEquals(0, map.size()); map.put("abc", Integer.valueOf(0)); Assert.assertEquals(1, map.size()); }
@Test public void clear_isEmpty() throws Exception { final StringKeyObjectMap<Integer> map = new StringKeyObjectMap<Integer>(); Assert.assertTrue(map.isEmpty()); map.put("abc", Integer.valueOf(0)); Assert.assertFalse(map.isEmpty()); Assert.assertEquals(Integer.valueOf(0), map.get("abc")); map.clear(); Assert.assertTrue(map.isEmpty()); Assert.assertNull(map.get("abc")); }
@Test public void containsKey_existingKey_ReturnsTrue() throws Exception { final StringKeyObjectMap<Integer> map = new StringKeyObjectMap<Integer>(); map.put("abc", Integer.valueOf(0)); Assert.assertTrue(map.containsKey("abc")); }