@Test
public void testCapabilities() throws IOException {

    DesiredCapabilities originalCapabilities = new DesiredCapabilities();
    originalCapabilities.setCapability(PLATFORM_NAME, "android");
    originalCapabilities.setCapability(BROWSER_NAME, "chrome");
    originalCapabilities.setCapability("chromeArguments", CHROME_OPTIONS_VALUE);
    AppiumDriverFactory factory = new AppiumDriverFactory();
    Capabilities newCapabilities = factory.getCapabilities(getMockedConfiguration(originalCapabilities));
    assertEquals(originalCapabilities.getCapability(PLATFORM_NAME), newCapabilities.getCapability(PLATFORM_NAME));
    assertEquals(originalCapabilities.getCapability(BROWSER_NAME), newCapabilities.getCapability(BROWSER_NAME));
    Object chromeOptions = newCapabilities.getCapability(ChromeOptions.CAPABILITY);
    assertTrue(new Gson().toJson(chromeOptions).contains(CHROME_OPTIONS_VALUE));
}