/** check the normal scenario works */
 @Test(timeout = 1000)
 public void basic() throws InterruptedException {
   // should work
   MockedRequestHandler newSessionRequest = new MockedNewSessionRequestHandler(registry, ff);
   newSessionRequest.process();
   TestSession s = newSessionRequest.getTestSession();
   Assert.assertNotNull(s);
   s.terminate();
   Assert.assertEquals(0, registry.getNewSessionRequests().size());
 }
 /** check the normal scenario works */
 @Test(timeout = 1000)
 public void basic() {
   // should work
   MockedRequestHandler newSessionRequest = GridHelper.createNewSessionHandler(registry, ff);
   newSessionRequest.process();
   TestSession s = newSessionRequest.getSession();
   assertNotNull(s);
   registry.terminate(s, SessionTerminationReason.CLIENT_STOPPED_SESSION);
   assertEquals(0, registry.getNewSessionRequestCount());
 }
 /** check the normal scenario works */
 @Test(timeout = 1000)
 public void basic() {
   // should work
   MockedRequestHandler newSessionRequest = new MockedNewSessionRequestHandler(registry, ff);
   newSessionRequest.process();
   TestSession s = newSessionRequest.getTestSession();
   Assert.assertNotNull(s);
   registry.terminate(s);
   Assert.assertEquals(0, registry.getNewSessionRequestCount());
 }
  /**
   * check that a crashes during the new session request handling doesn't result in a corrupted
   * state
   *
   * @throws InterruptedException
   */
  @Test(timeout = 1000)
  public void requestIsremovedFromTheQeueAfterItcrashes() throws InterruptedException {
    // should work
    try {
      MockedRequestHandler newSessionRequest =
          new MockedBuggyNewSessionRequestHandler(registry, ff);
      newSessionRequest.process();
    } catch (RuntimeException e) {
      System.out.println(e.getMessage());
    }

    Assert.assertEquals(0, registry.getNewSessionRequests().size());
  }
  /**
   * check that a crashes during the new session request handling doesn't result in a corrupted
   * state
   */
  @Test(timeout = 1000)
  public void requestIsremovedFromTheQeueAfterItcrashes() throws InterruptedException {
    // should work
    try {
      SeleniumBasedRequest newSession =
          GridHelper.createNewSessionRequest(registry, SeleniumProtocol.WebDriver, ff);
      MockedRequestHandler newSessionRequest =
          new MockedBuggyNewSessionRequestHandler(newSession, null, registry);
      newSessionRequest.process();
    } catch (RuntimeException e) {
      System.out.println(e.getMessage());
    }

    assertEquals(0, registry.getNewSessionRequestCount());
  }