### Question:
TraceeSessionListener implements HttpSessionListener { @Override public final void sessionCreated(HttpSessionEvent httpSessionEvent) { Utilities.generateSessionIdIfNecessary(backend, httpSessionEvent.getSession().getId()); } @SuppressWarnings("unused")  TraceeSessionListener(); protected  TraceeSessionListener(TraceeBackend backend); @Override final void sessionCreated(HttpSessionEvent httpSessionEvent); @Override final void sessionDestroyed(HttpSessionEvent httpSessionEvent);  }### Answer:
@Test public void testWriteSessionIdToContextOnCreateIfConfigured() { when(configuration.shouldGenerateSessionId()).thenReturn(true); unit.sessionCreated(new HttpSessionEvent(session)); verify(backend, atLeastOnce()).put(eq(SESSION_ID_KEY), anyString()); }
@Test public void testDontWriteSessionIdToContextOnCreateIfNotConfigured() { when(configuration.shouldGenerateSessionId()).thenReturn(false); unit.sessionCreated(new HttpSessionEvent(session)); verify(backend, never()).put(eq(SESSION_ID_KEY), anyString()); }