/**
* Test with a session.
*/
public void testSession() {
MockContainer container = new MockContainer("web");
container.start();
HttpSession session = container.getRequest().getSession();
SessionMap sm = new SessionMap(session);
Assert.assertEquals(0, sm.size());
Assert.assertEquals(0, sm.keySet().size());
Assert.assertEquals(0, sm.entrySet().size());
Assert.assertEquals(0, sm.values().size());
Assert.assertNull(sm.get("attrib1"));
Assert.assertNull(sm.get(null));
Assert.assertTrue(sm.isEmpty());
session.setAttribute("attrib1", "value1");
Assert.assertEquals("value1", sm.get("attrib1"));
Assert.assertEquals(1, sm.size());
Assert.assertEquals(1, sm.keySet().size());
Assert.assertTrue(sm.keySet().contains("attrib1"));
Assert.assertEquals(1, sm.entrySet().size());
Map.Entry<String, Object> entry = sm.entrySet().iterator().next();
Assert.assertEquals("attrib1", entry.getKey());
Assert.assertEquals("value1", entry.getValue());
Assert.assertEquals(1, sm.values().size());
Assert.assertTrue(sm.values().contains("value1"));
container.stop();
}