### Question:
LocalConfig { public synchronized String getConfigProperty(Config.ConfigProperty configProperty) { SeLionLogger.getLogger().entering(configProperty); checkArgument(configProperty != null, "Config property cannot be null"); String propValue = null; if (baseConfig.containsKey(configProperty.getName())) { propValue = baseConfig.getString(configProperty.getName()); } if (StringUtils.isBlank(propValue)) { propValue = Config.getConfigProperty(configProperty); } SeLionLogger.getLogger().exiting(propValue); return propValue; } LocalConfig();  LocalConfig(ConfigProperty configProperty, String value);  LocalConfig(Map<ConfigProperty, String> initialValues); synchronized String getConfigProperty(Config.ConfigProperty configProperty); synchronized List<Object> getListConfigProperty(Config.ConfigProperty configProperty); synchronized int getIntConfigProperty(Config.ConfigProperty configProperty); synchronized boolean getBooleanConfigProperty(Config.ConfigProperty configProperty); synchronized void setConfigProperty(Config.ConfigProperty configProperty, Object configPropertyValue); synchronized void printConfigValues(String testName); synchronized Map<String, String> getLocalConfigValues(); synchronized boolean isLocalValuePresent(ConfigProperty configProperty);  }### Answer:
@Test(groups = "unit") public void testLocalInitValues() { Map<ConfigProperty, String> initLocalValues = new HashMap<ConfigProperty, String>(); String localUserAgentValue = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML; like Gecko) Version/4.0 Mobile/7A341 Safari/528.16"; initLocalValues.put(ConfigProperty.SELENIUM_USERAGENT, localUserAgentValue); LocalConfig localConfig = new LocalConfig(initLocalValues); String testName = "test"; ConfigManager.addConfig(testName, localConfig); assertEquals(localConfig.getConfigProperty(ConfigProperty.SELENIUM_USERAGENT), localUserAgentValue, "Hostname value not as expected"); String userAgent = Config.getConfigProperty(ConfigProperty.SELENIUM_USERAGENT); assertNotNull(userAgent); assertTrue(!userAgent.equals(localUserAgentValue), "hostname values in localConfig and selionConfig should not match"); ConfigManager.removeConfig(testName); }
@Test(groups = "unit") public void testLocalGetConfigProperty() { LocalConfig localConfig = new LocalConfig(); String portNumber = localConfig.getConfigProperty(ConfigProperty.SELENIUM_PORT); assertTrue(!portNumber.isEmpty(), "selenium port returned by getConfigProperty cannot be empty."); }
@Test(groups = "unit", expectedExceptions = { IllegalArgumentException.class }) public void testLocalGetConfigNullValue() throws Exception { LocalConfig localConfig = new LocalConfig(); localConfig.getConfigProperty(null); }
@Test(groups = "parallelBrowserTest1") public void testParallelLocalConfigChrome(ITestContext ctx) { String name = ctx.getCurrentXmlTest().getName(); String default_browser = ConfigManager.getConfig(name).getConfigProperty(ConfigProperty.BROWSER); assertEquals(default_browser, "*chrome", "Browser config value for this test is not chrome."); }
@Test(groups = "parallelBrowserTest2") public void testParallelLocalConfigIE(ITestContext ctx) { String name = ctx.getCurrentXmlTest().getName(); String default_browser = ConfigManager.getConfig(name).getConfigProperty(ConfigProperty.BROWSER); assertEquals(default_browser, "*iexplore", "Browser config value for this test is not iexplore."); }
@Test(groups = "parallelBrowserTest3") public void testParallelLocalConfigFireFox(ITestContext ctx) { String name = ctx.getCurrentXmlTest().getName(); String default_browser = ConfigManager.getConfig(name).getConfigProperty(ConfigProperty.BROWSER); assertEquals(default_browser, "*firefox", "Browser config value for this test is not firefox."); }