### Question:
WebDriverSessionHandler { public void stop() throws ExecutionException { logger.exiting(); if (!bStartSession) { throw new IllegalStateException("Please call startSession() before calling endSession()"); } bStartSession = false; try { result.get(); } catch (InterruptedException e) { logger.log(Level.SEVERE, "InterruptedException occured while pinging the WebDriver", e); } logger.exiting(); } WebDriverSessionHandler(RemoteWebDriver driver); void start(); void stop();  }### Answer:
@Test(groups = "functional", expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "\\QPlease call startSession() before calling endSession()\\E") @WebTest public void testEndWebDriverSession() throws ExecutionException { WebDriverSessionHandler m = new WebDriverSessionHandler(Grid.driver()); m.stop(); }