AugmentingEnhancer implements DroneInstanceEnhancer<RemoteWebDriver> { @Override public RemoteWebDriver enhance(RemoteWebDriver instance, Class<? extends Annotation> qualifier) { RemoteWebDriver enhanced = (RemoteWebDriver) augmenter.augment(instance); return enhanced; }  @Override int getPrecedence(); @Override boolean canEnhance(InstanceOrCallableInstance instance, Class<?> droneType,
        Class<? extends Annotation> qualifier); @Override RemoteWebDriver enhance(RemoteWebDriver instance, Class<? extends Annotation> qualifier); @Override RemoteWebDriver deenhance(RemoteWebDriver enhancedInstance, Class<? extends Annotation> qualifier); static final String DRONE_AUGMENTED; }
@Test public void testEnhancing() { DesiredCapabilities capabilities = new DesiredCapabilities(); RemoteWebDriver driver = mock(RemoteWebDriver.class); when(driver.getCapabilities()).thenReturn(capabilities); capabilities.setCapability(AugmentingEnhancer.DRONE_AUGMENTED, driver); capabilities.setCapability(CapabilityType.TAKES_SCREENSHOT, Boolean.TRUE); RemoteWebDriver enhanced = enhancer.enhance(driver, Default.class); assertThat(enhanced, instanceOf(DroneAugmented.class)); assertThat(enhanced, instanceOf(TakesScreenshot.class)); assertEquals(driver, ((DroneAugmented) enhanced).getWrapped()); }