@Test
public void testGetSessionNoSessionIdCreate() {

  RequestWithSession request = mock(RequestWithSession.class);
  when(tracking.newId()).thenReturn("new-id");
  RepositoryBackedSession session = mock(RepositoryBackedSession.class);
  when(session.getId()).thenReturn("new-id");
  when(factory.build(any(SessionData.class))).thenReturn(session);
  RepositoryBackedSession retrievedSession = sessionManager.getSession(request, true, null);
  verify(request).setRequestedSessionId(null, false);
  verify(tracking).newId();
  assertEquals("Session id in Logging MDC is wrong", "new-id", MDC.get(configuration.getLoggingMdcKey()));
  assertSame(session, retrievedSession);
  assertEquals(1, metrics.meter(MetricRegistry.name(SessionManager.SESSIONS_METRIC_PREFIX, "created")).getCount());
}