@Test
  public void shouldExecuteJavascriptMethodsOnFlashObject() {
    FirefoxDriver delegate = Mockito.mock(FirefoxDriver.class);
    FlashDriver driver = new FlashDriver(delegate, "flashObjectId");

    driver.click();
    verify(delegate).executeScript("return arguments[0].click();", (Object[]) null);

    when(delegate.executeScript("return arguments[0].PercentLoaded();", (Object[]) null))
        .thenReturn("100");
    assertThat(driver.percentLoaded(), equalTo(100));
    verify(delegate).executeScript("return arguments[0].PercentLoaded();", (Object[]) null);
  }
 @Test(expected = JavascriptNotSupported.class)
 public void shouldThrowAnExceptionIfWebDriverIsNotAJavascriptExecutor() {
   WebDriver delegate = Mockito.mock(WebDriver.class);
   FlashDriver driver = new FlashDriver(delegate, "flashObjectId");
   driver.click();
 }