@Test
public void testEmptySessionLoading() throws Exception {

  DatastoreSession session = new DatastoreSession(manager);
  session.setValid(true);
  session.setId(keyId);
  Entity sessionEntity = session.saveMetadataToEntity(key);
  when(datastore.<Entity>run(any())).thenReturn(
      new IteratorQueryResults<>(Collections.singleton(sessionEntity).iterator()));
  Session loadedSession = store.load(keyId);
  verify(datastore).run(any());
  verify(manager).createEmptySession();
  assertEquals(loadedSession.getId(), keyId);
}