@Test public void testInstantiateFromMapWithBadBoolean() throws Exception { Map<String,String> map = new HashMap<String, String>(); map.put("browserName", "selendroid"); map.put("platformVersion", DeviceTargetPlatform.ANDROID16.getApi()); map.put("emulator", "kitkat"); try { SelendroidCapabilities capa = new SelendroidCapabilities(map); boolean em = capa.getEmulator(); Assert.fail("Expected exception, got: " + em); } catch (ClassCastException e) { String msg = e.getMessage(); Assert.assertTrue("Expected key in message: " + msg, msg.contains("emulator")); Assert.assertTrue("Expected value in message: " + msg, msg.contains("kitkat")); Assert.assertTrue("Expected class in message: " + msg, msg.contains("String")); } }
public Boolean getEmulator() { if (getRawCapabilities().get(EMULATOR) == null || getRawCapabilities().get(EMULATOR).equals(JSONObject.NULL)) return null; return getBooleanCapability(EMULATOR); }
SelendroidCapabilities extends DesiredCapabilities { public Boolean getEmulator() { if (getRawCapabilities().get(EMULATOR) == null || getRawCapabilities().get(EMULATOR).equals(JSONObject.NULL)) return null; return getBooleanCapability(EMULATOR); } }
SelendroidCapabilities extends DesiredCapabilities { public Boolean getEmulator() { if (getRawCapabilities().get(EMULATOR) == null || getRawCapabilities().get(EMULATOR).equals(JSONObject.NULL)) return null; return getBooleanCapability(EMULATOR); } SelendroidCapabilities(Map<String, ?> from);  SelendroidCapabilities(JSONObject source);  SelendroidCapabilities();  SelendroidCapabilities(String aut);  SelendroidCapabilities(String serial, String aut); }
SelendroidCapabilities extends DesiredCapabilities { public Boolean getEmulator() { if (getRawCapabilities().get(EMULATOR) == null || getRawCapabilities().get(EMULATOR).equals(JSONObject.NULL)) return null; return getBooleanCapability(EMULATOR); } SelendroidCapabilities(Map<String, ?> from);  SelendroidCapabilities(JSONObject source);  SelendroidCapabilities();  SelendroidCapabilities(String aut);  SelendroidCapabilities(String serial, String aut); static SelendroidCapabilities empty(); static SelendroidCapabilities copyOf(SelendroidCapabilities caps); String getSerial(); String getPlatformVersion(); String getAut(); String getModel(); String getAPITargetType(); String getLaunchActivity(); Boolean getEmulator(); boolean getUseJUnitBootstrap(); boolean getUseRandomLocalPort(); String getPlatformName(); String getAutomationName(); String getLocale(); Map<String, Object> getRawCapabilities(); String getScreenSize(); String getSelendroidExtensions(); String getBootstrapClassNames(); Object getExtraAUTArg(String key); JSONObject getExtraAUTArgs(); boolean hasExtraAUTArgs(); void addExtraAUTArg(String key, boolean value); void addExtraAUTArg(String key, int value); void addExtraAUTArg(String key, String value); void addExtraAUTArg(String key, JSONObject value); void setSerial(String serial); void setModel(String model); void setAPITargetType(String apiTargetType); void setPlatformVersion(DeviceTargetPlatform androidTarget); void setAut(String aut); void setLaunchActivity(String launchActivity); void setEmulator(Boolean emulator); void setUseJunitRunner(Boolean useJUnitRunner); void setUseRandomLocalPort(boolean useRandomLocalPort); void setLocale(String locale); void setScreenSize(String screenSize); SelendroidCapabilities setSelendroidExtensions(String filePath); SelendroidCapabilities addBootstrapClass(String className); static SelendroidCapabilities emulator(String aut); static SelendroidCapabilities emulator(DeviceTargetPlatform platform, String aut); static DesiredCapabilities android(DeviceTargetPlatform platform); @SuppressWarnings("unchecked") List<String> getPreSessionAdbCommands(); void setPreSessionAdbCommands(List<String> commands); static SelendroidCapabilities device(DeviceTargetPlatform platform, String aut); static SelendroidCapabilities device(String aut); SelendroidCapabilities withMerged(SelendroidCapabilities caps); String getDefaultApp(Set<String> supportedApps); }
SelendroidCapabilities extends DesiredCapabilities { public Boolean getEmulator() { if (getRawCapabilities().get(EMULATOR) == null || getRawCapabilities().get(EMULATOR).equals(JSONObject.NULL)) return null; return getBooleanCapability(EMULATOR); } SelendroidCapabilities(Map<String, ?> from);  SelendroidCapabilities(JSONObject source);  SelendroidCapabilities();  SelendroidCapabilities(String aut);  SelendroidCapabilities(String serial, String aut); static SelendroidCapabilities empty(); static SelendroidCapabilities copyOf(SelendroidCapabilities caps); String getSerial(); String getPlatformVersion(); String getAut(); String getModel(); String getAPITargetType(); String getLaunchActivity(); Boolean getEmulator(); boolean getUseJUnitBootstrap(); boolean getUseRandomLocalPort(); String getPlatformName(); String getAutomationName(); String getLocale(); Map<String, Object> getRawCapabilities(); String getScreenSize(); String getSelendroidExtensions(); String getBootstrapClassNames(); Object getExtraAUTArg(String key); JSONObject getExtraAUTArgs(); boolean hasExtraAUTArgs(); void addExtraAUTArg(String key, boolean value); void addExtraAUTArg(String key, int value); void addExtraAUTArg(String key, String value); void addExtraAUTArg(String key, JSONObject value); void setSerial(String serial); void setModel(String model); void setAPITargetType(String apiTargetType); void setPlatformVersion(DeviceTargetPlatform androidTarget); void setAut(String aut); void setLaunchActivity(String launchActivity); void setEmulator(Boolean emulator); void setUseJunitRunner(Boolean useJUnitRunner); void setUseRandomLocalPort(boolean useRandomLocalPort); void setLocale(String locale); void setScreenSize(String screenSize); SelendroidCapabilities setSelendroidExtensions(String filePath); SelendroidCapabilities addBootstrapClass(String className); static SelendroidCapabilities emulator(String aut); static SelendroidCapabilities emulator(DeviceTargetPlatform platform, String aut); static DesiredCapabilities android(DeviceTargetPlatform platform); @SuppressWarnings("unchecked") List<String> getPreSessionAdbCommands(); void setPreSessionAdbCommands(List<String> commands); static SelendroidCapabilities device(DeviceTargetPlatform platform, String aut); static SelendroidCapabilities device(String aut); SelendroidCapabilities withMerged(SelendroidCapabilities caps); String getDefaultApp(Set<String> supportedApps); static final String AUT; static final String EMULATOR; static final String DISPLAY; static final String LOCALE; static final String SCREEN_SIZE; static final String PRE_SESSION_ADB_COMMANDS; static final String SERIAL; static final String MODEL; static final String API_TARGET_TYPE; static final String PLATFORM_VERSION; static final String PLATFORM_NAME; static final String AUTOMATION_NAME; static final String LAUNCH_ACTIVITY; static final String SELENDROID_EXTENSIONS; static final String BOOTSTRAP_CLASS_NAMES; static final String EXTRA_ARGS; static final String USE_JUNIT_BOOTSTRAP; static final String USE_RANDOM_LOCAL_PORT; }