@Test
public void testAdd() {

    ScopedCollection<String> collection =
        new ScopedCollection<String>(observer);
    String test1 = "test1";
    String test2 = "test2";
    Assert.assertFalse(collection.contains(test1));
    Assert.assertFalse(collection.contains(test2));
    collection.add(test1);
    collection.add(test2);
    Assert.assertTrue(collection.contains(test1));
    Assert.assertTrue(collection.contains(test2));
    Assert.assertEquals(2, collection.size());
    collection.enterScope(Scope.SESSION, Scope.DOCUMENT);
    String test3 = "test3";
    collection.add(test3);
    Assert.assertTrue(collection.contains(test1));
    Assert.assertTrue(collection.contains(test2));
    Assert.assertTrue(collection.contains(test3));
    Assert.assertEquals(3, collection.size());
    collection.exitScope(Scope.DOCUMENT, Scope.SESSION);
    Assert.assertTrue(collection.contains(test1));
    Assert.assertTrue(collection.contains(test2));
    Assert.assertFalse(collection.contains(test3));
    Assert.assertEquals(2, collection.size());
}