void (String val) { String key = "key"; Map<Object, Object> map = factory.create(); Assume.assumeTrue("Adding (" + key + ", " + val + ") not supported", isSupported(() -> map.put(key, val))); Collection<Object> values = map.values(); Assert.assertTrue("Value not found", values.contains(val)); Assert.assertEquals(1, values.size()); Assume.assumeTrue("Values is readonly", isSupported(() -> values.clear())); Assert.assertEquals(0, values.size()); Assert.assertEquals(0, map.size()); map.put(key, val); Assert.assertEquals(1, values.size()); Iterator<?> it = values.iterator(); Assert.assertEquals(val, it.next()); it.remove(); Assert.assertEquals(0, values.size()); Assert.assertEquals(0, map.size()); map.put(key, val); values.remove(val); Assert.assertEquals(0, values.size()); Assert.assertEquals(0, map.size()); }