EventFiringWebDriver extends DecoratedWebDriver { public void removeAllListeners() { listeners.clear(); } EventFiringWebDriver(final WebDriver driver); void addListener(WebDriverListener listener); void removeListener(WebDriverListener listener); void removeAllListeners(); @Override void beforeMethodGlobal(Decorated<?> target, Method method, Object[] args); @Override void afterMethodGlobal(Decorated<?> target, Method method, Object res, Object[] args);  }
@Test void canRemoveAllListeners() { Fixture fixture = new Fixture(); fixture.decoratedDriver.removeAllListeners(); fixture.driver.get("http: verify(fixture.mockedDriver, times(1)).get("http: verifyZeroInteractions(fixture.listener); verifyZeroInteractions(fixture.listener2); }