Refactoring grid option preliminary analysis
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
@@ -71,7 +72,7 @@ default void printUsage(PrintStream out) {
private static Map<String, Function<String[], GridItemLauncher>> LAUNCHERS = buildLaunchers();
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) {
new GridLauncherV3(args).launch();
}
@@ -124,15 +125,16 @@ public GridLauncherV3(PrintStream out, String[] args) {
* @return null if no role is found, or a properly populated {@link GridItemLauncher}.
*/
private GridItemLauncher buildLauncher(String[] args) {
- String role = "standalone";
-
- for (int i = 0; i < args.length; i++) {
- if (args[i].equals("-htmlSuite")) {
+ if (Arrays.stream(args).anyMatch("-htmlSuite"::equals)) {
out.println(Joiner.on("\n").join(
"Download the Selenium HTML Runner from http://www.seleniumhq.org/download/ and",
"use that to run your HTML suite."));
return null;
}
+
+ String role = "standalone";
+
+ for (int i = 0; i < args.length; i++) {
if (args[i].startsWith("-role=")) {
role = args[i].substring("-role=".length());
} else if (args[i].equals("-role")) {
