@Test
public void testEntrySet() {

    final ScopedMap<String, String> map =
        new ScopedMap<String, String>(observer);
    map.enterScope(Scope.SESSION, Scope.DOCUMENT);
    Assert.assertNull(map.put("key1", "value1"));
    Assert.assertNull(map.put("key2", "value2"));
    final Set<Map.Entry<String, String>> entries = map.entrySet();
    Assert.assertFalse(entries.isEmpty());
    for (Map.Entry<String, String> entry : entries) {
        final String key = entry.getKey();
        Assert.assertTrue(key.equals("key1") || key.equals("key2"));
        final String value = entry.getValue();
        Assert.assertTrue(value.equals("value1") || value.equals("value2"));
    }
    final Iterator<Map.Entry<String, String>> iterator = entries.iterator();
    final Map.Entry<String, String> entry1 = iterator.next();
    final String key1 = entry1.getKey();
    final String value1 = entry1.getValue();
    final String value3 = "value3";
    Assert.assertEquals(value1, map.get(key1));
    Assert.assertEquals(value1, entry1.setValue(value3));
    Assert.assertEquals(value3, entry1.getValue());
    Assert.assertEquals(value3, map.get(key1));
    final String value4 = "value4";
    Assert.assertEquals(value3, entry1.setValue(value4));
    Assert.assertEquals(value4, entry1.getValue());
    Assert.assertEquals(value4, map.get(key1));
}