@Test
public void testCanEnhance() throws Exception {

    Unsafe unsafe = new Unsafe();
    RemoteWebDriver remoteDriver = unsafe.createInstanceWithoutInvokingConstructor(RemoteWebDriver.class);
    RemoteWebDriver reusableRemoteDriver = mock(ReusableRemoteWebDriver.class);
    DroneAugmented augmentedDriver = mock(DroneAugmented.class);
    InstanceOrCallableInstance instance1 = mock(InstanceOrCallableInstance.class);
    InstanceOrCallableInstance instance2 = mock(InstanceOrCallableInstance.class);
    InstanceOrCallableInstance instance3 = mock(InstanceOrCallableInstance.class);
    InstanceOrCallableInstance instance4 = mock(InstanceOrCallableInstance.class);
    doReturn(remoteDriver).when(instance1).asInstance(RemoteWebDriver.class);
    doReturn(remoteDriver).when(instance1).asInstance(WebDriver.class);
    doReturn(augmentedDriver).when(instance1).asInstance(ReusableRemoteWebDriver.class);
    doReturn(unsafe.createInstanceWithoutInvokingConstructor(FirefoxDriver.class)).when(instance2)
        .asInstance(WebDriver.class);
    doReturn(reusableRemoteDriver).when(instance3).asInstance(WebDriver.class);
    doReturn(augmentedDriver).when(instance4).asInstance(WebDriver.class);
    assertTrue("AugmentingEnhancer should enhance when droneType == RemoteWebDriver.class",
        enhancer.canEnhance(instance1, RemoteWebDriver.class, Default.class));
    assertTrue("AugmentingEnhancer should enhance when droneType == ReusableRemoteWebDriver.class",
        enhancer.canEnhance(instance1, ReusableRemoteWebDriver.class, Default.class));
    assertTrue("AugmentingEnhancer should enhance when real instance is RemoteWebDriver",
        enhancer.canEnhance(instance1, WebDriver.class, Default.class));
    assertTrue("AugmentingEnhancer should enhance when real instance already augmented!",
        enhancer.canEnhance(instance4, WebDriver.class, Default.class));
    assertFalse(
        "AugmentingEnhancer should not enhance when real instance is not RemoteWebDriver || ReusableRemoteWebDriver",
        enhancer.canEnhance(instance2, WebDriver.class, Default.class));
    assertFalse("AugmentingEnhancer should not enhance extensions of supported classes!",
        enhancer.canEnhance(instance3, WebDriver.class, Default.class));
}