@Test
public void testValues() {

    final ScopedMap<String, String> map =
            new ScopedMap<String, String>(observer);
    Assert.assertNull(map.put("key1", "value1"));
    Assert.assertEquals("value1", map.get("key1"));
    Assert.assertNull(map.put("key2", "value2"));
    Assert.assertEquals("value1", map.get("key1"));
    Assert.assertEquals("value2", map.get("key2"));
    final Collection<String> values1 = map.values();
    Assert.assertEquals(2, values1.size());
    Assert.assertTrue(values1.contains("value1"));
    Assert.assertTrue(values1.contains("value2"));
    map.enterScope(Scope.SESSION, Scope.DOCUMENT);
    Assert.assertEquals("value1", map.get("key1"));
    Assert.assertEquals("value2", map.get("key2"));
    final Collection<String> values2 = map.values();
    Assert.assertEquals(2, values2.size());
    Assert.assertTrue(values2.contains("value1"));
    Assert.assertTrue(values2.contains("value2"));
    Assert.assertEquals("value2", map.put("key2", "value3"));
    Assert.assertEquals("value1", map.get("key1"));
    Assert.assertEquals("value3", map.get("key2"));
    final Collection<String> values3 = map.values();
    Assert.assertEquals(2, values3.size());
    Assert.assertTrue(values3.contains("value1"));
    Assert.assertTrue(values3.contains("value3"));
    map.exitScope(Scope.DOCUMENT, Scope.SESSION);
    Assert.assertEquals("value1", map.get("key1"));
    Assert.assertEquals("value2", map.get("key2"));
    final Collection<String> values4 = map.values();
    Assert.assertEquals(2, values4.size());
    Assert.assertTrue(values4.contains("value1"));
    Assert.assertTrue(values4.contains("value2"));
}