@Test @SuppressWarnings("unchecked") public void testVar() { Main main = new Main(); Runner runner = new Runner(); IConfig config = new DefaultConfig( "-d", "htmlunit", "-V", "key1=null", "-V", "key2=1", "-V", "key3='str'", "-V", "key4=['a', 'b', 'c']", "-V", "key5={'A':1,'B':2,'C':3}"); main.setupRunner(runner, config); VarsMap varsMap = runner.getVarsMap(); assertThat(varsMap.get("key1"), is(nullValue())); assertThat(varsMap.get("key2"), is(1.0)); assertThat(varsMap.get("key3"), is("str")); assertThat((List<String>) varsMap.get("key4"), is(contains("a", "b", "c"))); Map<Object, Object> value5 = (Map<Object, Object>) varsMap.get("key5"); assertThat(value5, is(notNullValue())); assertThat(value5.get("A"), is(1.0)); assertThat(value5.get("B"), is(2.0)); assertThat(value5.get("C"), is(3.0)); }
public void setupRunner(Runner runner, IConfig config, String... filenames) { if (config.getMaxTime() != null) { long maxTime = NumberUtils.toLong(config.getMaxTime(), 0); if (maxTime <= 0) throw new IllegalArgumentException("Invalid max time value. (" + config.getMaxTime() + ")"); runner.setupMaxTimeTimer(maxTime * 1000); } String driverName = config.getDriver(); DriverOptions driverOptions = new DriverOptions(config); if (driverName == null) { if (driverOptions.has(DriverOption.FIREFOX) || driverOptions.has(DriverOption.GECKODRIVER)) driverName = WebDriverManager.FIREFOX; else if (driverOptions.has(DriverOption.CHROMEDRIVER)) driverName = WebDriverManager.CHROME; else if (driverOptions.has(DriverOption.IEDRIVER)) driverName = WebDriverManager.IE; else if (driverOptions.has(DriverOption.EDGEDRIVER)) driverName = WebDriverManager.EDGE; else if (driverOptions.has(DriverOption.PHANTOMJS)) driverName = WebDriverManager.PHANTOMJS; } WebDriverManager manager = WebDriverManager.newInstance(); manager.setWebDriverFactory(driverName); manager.setDriverOptions(driverOptions); if (config.getCommandFactory() != null) { String factoryName = config.getCommandFactory(); ICommandFactory factory; try { Class<?> factoryClass = Class.forName(factoryName); factory = (ICommandFactory) factoryClass.getConstructor().newInstance(); } catch (Exception e) { e.printStackTrace(); throw new IllegalArgumentException("invalid user defined command factory: " + factoryName); } runner.getCommandFactory().registerCommandFactory(factory); log.info("Registered: {}", factoryName); } runner.setDriver(manager.get()); runner.setWebDriverPreparator(manager); if (config.isHighlight()) runner.setHighlight(true); if (config.isInteractive()) runner.setInteractive(true); if (config.getScreenshotDir() != null) runner.setScreenshotDir(config.getScreenshotDir()); if (config.getScreenshotAll() != null) runner.setScreenshotAllDir(config.getScreenshotAll()); if (config.getScreenshotOnFail() != null) runner.setScreenshotOnFailDir(config.getScreenshotOnFail()); if (config.getBaseurl() != null) runner.setOverridingBaseURL(config.getBaseurl()); if (config.isIgnoreScreenshotCommand()) runner.setIgnoredScreenshotCommand(true); if (config.getVar() != null) { Gson gson = new Gson(); VarsMap varsMap = runner.getVarsMap(); for (String expr : config.getVar()) { Matcher matcher = EXPR_RE.matcher(expr); if (!matcher.matches()) throw new IllegalArgumentException("invalid var option format: " + expr); String name = matcher.group("varName"); Object value; try { value = gson.fromJson(matcher.group("jsonValue"), Object.class); } catch (JsonSyntaxException e) { throw new IllegalArgumentException("JSON syntax error: " + expr); } varsMap.put(name, value); } } if (config.getRollup() != null) { String[] rollups = config.getRollup(); for (String rollup : rollups) runner.getRollupRules().load(rollup); } if (config.getLogFilter() != null) { LogFilter.parse(runner.getLogFilter(), config.getLogFilter()); } if (config.getCookieFilter() != null) { String cookieFilter = config.getCookieFilter(); if (cookieFilter.length() < 2) throw new IllegalArgumentException("invalid cookie filter format: " + cookieFilter); FilterType filterType; switch (cookieFilter.charAt(0)) { case '+': filterType = FilterType.PASS; break; case '-': filterType = FilterType.SKIP; break; default: throw new IllegalArgumentException("invalid cookie filter format: " + cookieFilter); } String pattern = cookieFilter.substring(1); runner.setCookieFilter(new CookieFilter(filterType, pattern)); } if (config.getXmlResult() != null) runner.setJUnitResultDir(config.getXmlResult()); if (config.getHtmlResult() != null) runner.setHtmlResultDir(config.getHtmlResult()); int timeout = NumberUtils.toInt(config.getTimeout(), DEFAULT_TIMEOUT_MILLISEC_N); if (timeout <= 0) throw new IllegalArgumentException("Invalid timeout value. (" + config.getTimeout() + ")"); runner.setTimeout(timeout); int maxRetries = NumberUtils.toInt(config.getMaxRetries(), DEFAULT_MAX_RETRIES); if ((maxRetries < 0) || (maxRetries > 10)) throw new IllegalArgumentException("Invalid value: 0 <= maxRetries <= 10. (" + config.getMaxRetries() + ")"); runner.setMaxRetries(maxRetries); int speed = NumberUtils.toInt(config.getSetSpeed(), 0); if (speed < 0) throw new IllegalArgumentException("Invalid speed value. (" + config.getSetSpeed() + ")"); runner.setInitialSpeed(speed); if (config.isNoExit()) noExit = true; if (config.isStrictExitCode()) exitStrictly = true; int sstimeout = NumberUtils.toInt(config.getScreenshotScrollTimeout(), 100); if (sstimeout < 0) throw new IllegalArgumentException("Invalid screenshot scroll timeout value. (" + config.getScreenshotScrollTimeout() + ")"); runner.setScreenshotScrollTimeout(sstimeout); runner.setPrintStream(System.out); }
Main { public void setupRunner(Runner runner, IConfig config, String... filenames) { if (config.getMaxTime() != null) { long maxTime = NumberUtils.toLong(config.getMaxTime(), 0); if (maxTime <= 0) throw new IllegalArgumentException("Invalid max time value. (" + config.getMaxTime() + ")"); runner.setupMaxTimeTimer(maxTime * 1000); } String driverName = config.getDriver(); DriverOptions driverOptions = new DriverOptions(config); if (driverName == null) { if (driverOptions.has(DriverOption.FIREFOX) || driverOptions.has(DriverOption.GECKODRIVER)) driverName = WebDriverManager.FIREFOX; else if (driverOptions.has(DriverOption.CHROMEDRIVER)) driverName = WebDriverManager.CHROME; else if (driverOptions.has(DriverOption.IEDRIVER)) driverName = WebDriverManager.IE; else if (driverOptions.has(DriverOption.EDGEDRIVER)) driverName = WebDriverManager.EDGE; else if (driverOptions.has(DriverOption.PHANTOMJS)) driverName = WebDriverManager.PHANTOMJS; } WebDriverManager manager = WebDriverManager.newInstance(); manager.setWebDriverFactory(driverName); manager.setDriverOptions(driverOptions); if (config.getCommandFactory() != null) { String factoryName = config.getCommandFactory(); ICommandFactory factory; try { Class<?> factoryClass = Class.forName(factoryName); factory = (ICommandFactory) factoryClass.getConstructor().newInstance(); } catch (Exception e) { e.printStackTrace(); throw new IllegalArgumentException("invalid user defined command factory: " + factoryName); } runner.getCommandFactory().registerCommandFactory(factory); log.info("Registered: {}", factoryName); } runner.setDriver(manager.get()); runner.setWebDriverPreparator(manager); if (config.isHighlight()) runner.setHighlight(true); if (config.isInteractive()) runner.setInteractive(true); if (config.getScreenshotDir() != null) runner.setScreenshotDir(config.getScreenshotDir()); if (config.getScreenshotAll() != null) runner.setScreenshotAllDir(config.getScreenshotAll()); if (config.getScreenshotOnFail() != null) runner.setScreenshotOnFailDir(config.getScreenshotOnFail()); if (config.getBaseurl() != null) runner.setOverridingBaseURL(config.getBaseurl()); if (config.isIgnoreScreenshotCommand()) runner.setIgnoredScreenshotCommand(true); if (config.getVar() != null) { Gson gson = new Gson(); VarsMap varsMap = runner.getVarsMap(); for (String expr : config.getVar()) { Matcher matcher = EXPR_RE.matcher(expr); if (!matcher.matches()) throw new IllegalArgumentException("invalid var option format: " + expr); String name = matcher.group("varName"); Object value; try { value = gson.fromJson(matcher.group("jsonValue"), Object.class); } catch (JsonSyntaxException e) { throw new IllegalArgumentException("JSON syntax error: " + expr); } varsMap.put(name, value); } } if (config.getRollup() != null) { String[] rollups = config.getRollup(); for (String rollup : rollups) runner.getRollupRules().load(rollup); } if (config.getLogFilter() != null) { LogFilter.parse(runner.getLogFilter(), config.getLogFilter()); } if (config.getCookieFilter() != null) { String cookieFilter = config.getCookieFilter(); if (cookieFilter.length() < 2) throw new IllegalArgumentException("invalid cookie filter format: " + cookieFilter); FilterType filterType; switch (cookieFilter.charAt(0)) { case '+': filterType = FilterType.PASS; break; case '-': filterType = FilterType.SKIP; break; default: throw new IllegalArgumentException("invalid cookie filter format: " + cookieFilter); } String pattern = cookieFilter.substring(1); runner.setCookieFilter(new CookieFilter(filterType, pattern)); } if (config.getXmlResult() != null) runner.setJUnitResultDir(config.getXmlResult()); if (config.getHtmlResult() != null) runner.setHtmlResultDir(config.getHtmlResult()); int timeout = NumberUtils.toInt(config.getTimeout(), DEFAULT_TIMEOUT_MILLISEC_N); if (timeout <= 0) throw new IllegalArgumentException("Invalid timeout value. (" + config.getTimeout() + ")"); runner.setTimeout(timeout); int maxRetries = NumberUtils.toInt(config.getMaxRetries(), DEFAULT_MAX_RETRIES); if ((maxRetries < 0) || (maxRetries > 10)) throw new IllegalArgumentException("Invalid value: 0 <= maxRetries <= 10. (" + config.getMaxRetries() + ")"); runner.setMaxRetries(maxRetries); int speed = NumberUtils.toInt(config.getSetSpeed(), 0); if (speed < 0) throw new IllegalArgumentException("Invalid speed value. (" + config.getSetSpeed() + ")"); runner.setInitialSpeed(speed); if (config.isNoExit()) noExit = true; if (config.isStrictExitCode()) exitStrictly = true; int sstimeout = NumberUtils.toInt(config.getScreenshotScrollTimeout(), 100); if (sstimeout < 0) throw new IllegalArgumentException("Invalid screenshot scroll timeout value. (" + config.getScreenshotScrollTimeout() + ")"); runner.setScreenshotScrollTimeout(sstimeout); runner.setPrintStream(System.out); } }
Main { public void setupRunner(Runner runner, IConfig config, String... filenames) { if (config.getMaxTime() != null) { long maxTime = NumberUtils.toLong(config.getMaxTime(), 0); if (maxTime <= 0) throw new IllegalArgumentException("Invalid max time value. (" + config.getMaxTime() + ")"); runner.setupMaxTimeTimer(maxTime * 1000); } String driverName = config.getDriver(); DriverOptions driverOptions = new DriverOptions(config); if (driverName == null) { if (driverOptions.has(DriverOption.FIREFOX) || driverOptions.has(DriverOption.GECKODRIVER)) driverName = WebDriverManager.FIREFOX; else if (driverOptions.has(DriverOption.CHROMEDRIVER)) driverName = WebDriverManager.CHROME; else if (driverOptions.has(DriverOption.IEDRIVER)) driverName = WebDriverManager.IE; else if (driverOptions.has(DriverOption.EDGEDRIVER)) driverName = WebDriverManager.EDGE; else if (driverOptions.has(DriverOption.PHANTOMJS)) driverName = WebDriverManager.PHANTOMJS; } WebDriverManager manager = WebDriverManager.newInstance(); manager.setWebDriverFactory(driverName); manager.setDriverOptions(driverOptions); if (config.getCommandFactory() != null) { String factoryName = config.getCommandFactory(); ICommandFactory factory; try { Class<?> factoryClass = Class.forName(factoryName); factory = (ICommandFactory) factoryClass.getConstructor().newInstance(); } catch (Exception e) { e.printStackTrace(); throw new IllegalArgumentException("invalid user defined command factory: " + factoryName); } runner.getCommandFactory().registerCommandFactory(factory); log.info("Registered: {}", factoryName); } runner.setDriver(manager.get()); runner.setWebDriverPreparator(manager); if (config.isHighlight()) runner.setHighlight(true); if (config.isInteractive()) runner.setInteractive(true); if (config.getScreenshotDir() != null) runner.setScreenshotDir(config.getScreenshotDir()); if (config.getScreenshotAll() != null) runner.setScreenshotAllDir(config.getScreenshotAll()); if (config.getScreenshotOnFail() != null) runner.setScreenshotOnFailDir(config.getScreenshotOnFail()); if (config.getBaseurl() != null) runner.setOverridingBaseURL(config.getBaseurl()); if (config.isIgnoreScreenshotCommand()) runner.setIgnoredScreenshotCommand(true); if (config.getVar() != null) { Gson gson = new Gson(); VarsMap varsMap = runner.getVarsMap(); for (String expr : config.getVar()) { Matcher matcher = EXPR_RE.matcher(expr); if (!matcher.matches()) throw new IllegalArgumentException("invalid var option format: " + expr); String name = matcher.group("varName"); Object value; try { value = gson.fromJson(matcher.group("jsonValue"), Object.class); } catch (JsonSyntaxException e) { throw new IllegalArgumentException("JSON syntax error: " + expr); } varsMap.put(name, value); } } if (config.getRollup() != null) { String[] rollups = config.getRollup(); for (String rollup : rollups) runner.getRollupRules().load(rollup); } if (config.getLogFilter() != null) { LogFilter.parse(runner.getLogFilter(), config.getLogFilter()); } if (config.getCookieFilter() != null) { String cookieFilter = config.getCookieFilter(); if (cookieFilter.length() < 2) throw new IllegalArgumentException("invalid cookie filter format: " + cookieFilter); FilterType filterType; switch (cookieFilter.charAt(0)) { case '+': filterType = FilterType.PASS; break; case '-': filterType = FilterType.SKIP; break; default: throw new IllegalArgumentException("invalid cookie filter format: " + cookieFilter); } String pattern = cookieFilter.substring(1); runner.setCookieFilter(new CookieFilter(filterType, pattern)); } if (config.getXmlResult() != null) runner.setJUnitResultDir(config.getXmlResult()); if (config.getHtmlResult() != null) runner.setHtmlResultDir(config.getHtmlResult()); int timeout = NumberUtils.toInt(config.getTimeout(), DEFAULT_TIMEOUT_MILLISEC_N); if (timeout <= 0) throw new IllegalArgumentException("Invalid timeout value. (" + config.getTimeout() + ")"); runner.setTimeout(timeout); int maxRetries = NumberUtils.toInt(config.getMaxRetries(), DEFAULT_MAX_RETRIES); if ((maxRetries < 0) || (maxRetries > 10)) throw new IllegalArgumentException("Invalid value: 0 <= maxRetries <= 10. (" + config.getMaxRetries() + ")"); runner.setMaxRetries(maxRetries); int speed = NumberUtils.toInt(config.getSetSpeed(), 0); if (speed < 0) throw new IllegalArgumentException("Invalid speed value. (" + config.getSetSpeed() + ")"); runner.setInitialSpeed(speed); if (config.isNoExit()) noExit = true; if (config.isStrictExitCode()) exitStrictly = true; int sstimeout = NumberUtils.toInt(config.getScreenshotScrollTimeout(), 100); if (sstimeout < 0) throw new IllegalArgumentException("Invalid screenshot scroll timeout value. (" + config.getScreenshotScrollTimeout() + ")"); runner.setScreenshotScrollTimeout(sstimeout); runner.setPrintStream(System.out); }  }
Main { public void setupRunner(Runner runner, IConfig config, String... filenames) { if (config.getMaxTime() != null) { long maxTime = NumberUtils.toLong(config.getMaxTime(), 0); if (maxTime <= 0) throw new IllegalArgumentException("Invalid max time value. (" + config.getMaxTime() + ")"); runner.setupMaxTimeTimer(maxTime * 1000); } String driverName = config.getDriver(); DriverOptions driverOptions = new DriverOptions(config); if (driverName == null) { if (driverOptions.has(DriverOption.FIREFOX) || driverOptions.has(DriverOption.GECKODRIVER)) driverName = WebDriverManager.FIREFOX; else if (driverOptions.has(DriverOption.CHROMEDRIVER)) driverName = WebDriverManager.CHROME; else if (driverOptions.has(DriverOption.IEDRIVER)) driverName = WebDriverManager.IE; else if (driverOptions.has(DriverOption.EDGEDRIVER)) driverName = WebDriverManager.EDGE; else if (driverOptions.has(DriverOption.PHANTOMJS)) driverName = WebDriverManager.PHANTOMJS; } WebDriverManager manager = WebDriverManager.newInstance(); manager.setWebDriverFactory(driverName); manager.setDriverOptions(driverOptions); if (config.getCommandFactory() != null) { String factoryName = config.getCommandFactory(); ICommandFactory factory; try { Class<?> factoryClass = Class.forName(factoryName); factory = (ICommandFactory) factoryClass.getConstructor().newInstance(); } catch (Exception e) { e.printStackTrace(); throw new IllegalArgumentException("invalid user defined command factory: " + factoryName); } runner.getCommandFactory().registerCommandFactory(factory); log.info("Registered: {}", factoryName); } runner.setDriver(manager.get()); runner.setWebDriverPreparator(manager); if (config.isHighlight()) runner.setHighlight(true); if (config.isInteractive()) runner.setInteractive(true); if (config.getScreenshotDir() != null) runner.setScreenshotDir(config.getScreenshotDir()); if (config.getScreenshotAll() != null) runner.setScreenshotAllDir(config.getScreenshotAll()); if (config.getScreenshotOnFail() != null) runner.setScreenshotOnFailDir(config.getScreenshotOnFail()); if (config.getBaseurl() != null) runner.setOverridingBaseURL(config.getBaseurl()); if (config.isIgnoreScreenshotCommand()) runner.setIgnoredScreenshotCommand(true); if (config.getVar() != null) { Gson gson = new Gson(); VarsMap varsMap = runner.getVarsMap(); for (String expr : config.getVar()) { Matcher matcher = EXPR_RE.matcher(expr); if (!matcher.matches()) throw new IllegalArgumentException("invalid var option format: " + expr); String name = matcher.group("varName"); Object value; try { value = gson.fromJson(matcher.group("jsonValue"), Object.class); } catch (JsonSyntaxException e) { throw new IllegalArgumentException("JSON syntax error: " + expr); } varsMap.put(name, value); } } if (config.getRollup() != null) { String[] rollups = config.getRollup(); for (String rollup : rollups) runner.getRollupRules().load(rollup); } if (config.getLogFilter() != null) { LogFilter.parse(runner.getLogFilter(), config.getLogFilter()); } if (config.getCookieFilter() != null) { String cookieFilter = config.getCookieFilter(); if (cookieFilter.length() < 2) throw new IllegalArgumentException("invalid cookie filter format: " + cookieFilter); FilterType filterType; switch (cookieFilter.charAt(0)) { case '+': filterType = FilterType.PASS; break; case '-': filterType = FilterType.SKIP; break; default: throw new IllegalArgumentException("invalid cookie filter format: " + cookieFilter); } String pattern = cookieFilter.substring(1); runner.setCookieFilter(new CookieFilter(filterType, pattern)); } if (config.getXmlResult() != null) runner.setJUnitResultDir(config.getXmlResult()); if (config.getHtmlResult() != null) runner.setHtmlResultDir(config.getHtmlResult()); int timeout = NumberUtils.toInt(config.getTimeout(), DEFAULT_TIMEOUT_MILLISEC_N); if (timeout <= 0) throw new IllegalArgumentException("Invalid timeout value. (" + config.getTimeout() + ")"); runner.setTimeout(timeout); int maxRetries = NumberUtils.toInt(config.getMaxRetries(), DEFAULT_MAX_RETRIES); if ((maxRetries < 0) || (maxRetries > 10)) throw new IllegalArgumentException("Invalid value: 0 <= maxRetries <= 10. (" + config.getMaxRetries() + ")"); runner.setMaxRetries(maxRetries); int speed = NumberUtils.toInt(config.getSetSpeed(), 0); if (speed < 0) throw new IllegalArgumentException("Invalid speed value. (" + config.getSetSpeed() + ")"); runner.setInitialSpeed(speed); if (config.isNoExit()) noExit = true; if (config.isStrictExitCode()) exitStrictly = true; int sstimeout = NumberUtils.toInt(config.getScreenshotScrollTimeout(), 100); if (sstimeout < 0) throw new IllegalArgumentException("Invalid screenshot scroll timeout value. (" + config.getScreenshotScrollTimeout() + ")"); runner.setScreenshotScrollTimeout(sstimeout); runner.setPrintStream(System.out); }  static String getVersion(); void run(String[] args); void setupRunner(Runner runner, IConfig config, String... filenames); Integer getExitCode(); static void main(String[] args); }
Main { public void setupRunner(Runner runner, IConfig config, String... filenames) { if (config.getMaxTime() != null) { long maxTime = NumberUtils.toLong(config.getMaxTime(), 0); if (maxTime <= 0) throw new IllegalArgumentException("Invalid max time value. (" + config.getMaxTime() + ")"); runner.setupMaxTimeTimer(maxTime * 1000); } String driverName = config.getDriver(); DriverOptions driverOptions = new DriverOptions(config); if (driverName == null) { if (driverOptions.has(DriverOption.FIREFOX) || driverOptions.has(DriverOption.GECKODRIVER)) driverName = WebDriverManager.FIREFOX; else if (driverOptions.has(DriverOption.CHROMEDRIVER)) driverName = WebDriverManager.CHROME; else if (driverOptions.has(DriverOption.IEDRIVER)) driverName = WebDriverManager.IE; else if (driverOptions.has(DriverOption.EDGEDRIVER)) driverName = WebDriverManager.EDGE; else if (driverOptions.has(DriverOption.PHANTOMJS)) driverName = WebDriverManager.PHANTOMJS; } WebDriverManager manager = WebDriverManager.newInstance(); manager.setWebDriverFactory(driverName); manager.setDriverOptions(driverOptions); if (config.getCommandFactory() != null) { String factoryName = config.getCommandFactory(); ICommandFactory factory; try { Class<?> factoryClass = Class.forName(factoryName); factory = (ICommandFactory) factoryClass.getConstructor().newInstance(); } catch (Exception e) { e.printStackTrace(); throw new IllegalArgumentException("invalid user defined command factory: " + factoryName); } runner.getCommandFactory().registerCommandFactory(factory); log.info("Registered: {}", factoryName); } runner.setDriver(manager.get()); runner.setWebDriverPreparator(manager); if (config.isHighlight()) runner.setHighlight(true); if (config.isInteractive()) runner.setInteractive(true); if (config.getScreenshotDir() != null) runner.setScreenshotDir(config.getScreenshotDir()); if (config.getScreenshotAll() != null) runner.setScreenshotAllDir(config.getScreenshotAll()); if (config.getScreenshotOnFail() != null) runner.setScreenshotOnFailDir(config.getScreenshotOnFail()); if (config.getBaseurl() != null) runner.setOverridingBaseURL(config.getBaseurl()); if (config.isIgnoreScreenshotCommand()) runner.setIgnoredScreenshotCommand(true); if (config.getVar() != null) { Gson gson = new Gson(); VarsMap varsMap = runner.getVarsMap(); for (String expr : config.getVar()) { Matcher matcher = EXPR_RE.matcher(expr); if (!matcher.matches()) throw new IllegalArgumentException("invalid var option format: " + expr); String name = matcher.group("varName"); Object value; try { value = gson.fromJson(matcher.group("jsonValue"), Object.class); } catch (JsonSyntaxException e) { throw new IllegalArgumentException("JSON syntax error: " + expr); } varsMap.put(name, value); } } if (config.getRollup() != null) { String[] rollups = config.getRollup(); for (String rollup : rollups) runner.getRollupRules().load(rollup); } if (config.getLogFilter() != null) { LogFilter.parse(runner.getLogFilter(), config.getLogFilter()); } if (config.getCookieFilter() != null) { String cookieFilter = config.getCookieFilter(); if (cookieFilter.length() < 2) throw new IllegalArgumentException("invalid cookie filter format: " + cookieFilter); FilterType filterType; switch (cookieFilter.charAt(0)) { case '+': filterType = FilterType.PASS; break; case '-': filterType = FilterType.SKIP; break; default: throw new IllegalArgumentException("invalid cookie filter format: " + cookieFilter); } String pattern = cookieFilter.substring(1); runner.setCookieFilter(new CookieFilter(filterType, pattern)); } if (config.getXmlResult() != null) runner.setJUnitResultDir(config.getXmlResult()); if (config.getHtmlResult() != null) runner.setHtmlResultDir(config.getHtmlResult()); int timeout = NumberUtils.toInt(config.getTimeout(), DEFAULT_TIMEOUT_MILLISEC_N); if (timeout <= 0) throw new IllegalArgumentException("Invalid timeout value. (" + config.getTimeout() + ")"); runner.setTimeout(timeout); int maxRetries = NumberUtils.toInt(config.getMaxRetries(), DEFAULT_MAX_RETRIES); if ((maxRetries < 0) || (maxRetries > 10)) throw new IllegalArgumentException("Invalid value: 0 <= maxRetries <= 10. (" + config.getMaxRetries() + ")"); runner.setMaxRetries(maxRetries); int speed = NumberUtils.toInt(config.getSetSpeed(), 0); if (speed < 0) throw new IllegalArgumentException("Invalid speed value. (" + config.getSetSpeed() + ")"); runner.setInitialSpeed(speed); if (config.isNoExit()) noExit = true; if (config.isStrictExitCode()) exitStrictly = true; int sstimeout = NumberUtils.toInt(config.getScreenshotScrollTimeout(), 100); if (sstimeout < 0) throw new IllegalArgumentException("Invalid screenshot scroll timeout value. (" + config.getScreenshotScrollTimeout() + ")"); runner.setScreenshotScrollTimeout(sstimeout); runner.setPrintStream(System.out); }  static String getVersion(); void run(String[] args); void setupRunner(Runner runner, IConfig config, String... filenames); Integer getExitCode(); static void main(String[] args); static final String PROG_TITLE; }