when(configuration.isRemoteReusable()).thenReturn(true);
when(configuration.getCapabilities()).thenReturn(desiredCapabilities);
when(configuration.getRemoteAddress()).thenReturn(hubUrl);
// when
fire(new BeforeSuite());
// creates new session
RemoteWebDriver webdriver1 = factory1.createInstance(configuration);
// persists session into store
factory1.destroyInstance(webdriver1);
// makes driver non-reusable
webdriver1.quit();
// new suite
fire(new BeforeSuite());
// pulls non-reusable session from store, so creates new session
RemoteWebDriver webdriver2 = factory2.createInstance(configuration);
// quit newly created session
factory2.destroyInstance(webdriver2);
webdriver2.quit();
// persists available sessions (none should be available)
// persistEvent.fire(new PersistReusedSessionsEvent());
// new suite
fire(new BeforeSuite());
// pulls session - should *NOT* be empty
ReusedSession reusedSession = sessionStore.get().pull(initializationParameter);
assertNotNull("reusedSession must be stored", reusedSession);
// pulls session - should be empty - it was cleared by last pull
reusedSession = sessionStore.get().pull(initializationParameter);