@Test public void handleConfig() { OptionParser optionParser = new OptionParser(); Path file = optionParser.handleConfigOption(cmd); assertEquals(configFile.toString(), file.toString()); }
public Path handleConfigOption(CommandLine cmd) { Path configPath = Paths.get(cmd.getOptionValue("c")); if (!configPath.toFile().isFile()) { throw new IllegalArgumentException("the input configuration path does not point to a local file."); } System.out.print("Valid config path: "); System.out.println(cmd.getOptionValue("c")); return configPath; }
OptionParser { public Path handleConfigOption(CommandLine cmd) { Path configPath = Paths.get(cmd.getOptionValue("c")); if (!configPath.toFile().isFile()) { throw new IllegalArgumentException("the input configuration path does not point to a local file."); } System.out.print("Valid config path: "); System.out.println(cmd.getOptionValue("c")); return configPath; } }
OptionParser { public Path handleConfigOption(CommandLine cmd) { Path configPath = Paths.get(cmd.getOptionValue("c")); if (!configPath.toFile().isFile()) { throw new IllegalArgumentException("the input configuration path does not point to a local file."); } System.out.print("Valid config path: "); System.out.println(cmd.getOptionValue("c")); return configPath; } OptionParser(); }
OptionParser { public Path handleConfigOption(CommandLine cmd) { Path configPath = Paths.get(cmd.getOptionValue("c")); if (!configPath.toFile().isFile()) { throw new IllegalArgumentException("the input configuration path does not point to a local file."); } System.out.print("Valid config path: "); System.out.println(cmd.getOptionValue("c")); return configPath; } OptionParser(); Options getOptions(); Path handleTemplateOption(CommandLine cmd); Path handleConfigOption(CommandLine cmd); }
OptionParser { public Path handleConfigOption(CommandLine cmd) { Path configPath = Paths.get(cmd.getOptionValue("c")); if (!configPath.toFile().isFile()) { throw new IllegalArgumentException("the input configuration path does not point to a local file."); } System.out.print("Valid config path: "); System.out.println(cmd.getOptionValue("c")); return configPath; } OptionParser(); Options getOptions(); Path handleTemplateOption(CommandLine cmd); Path handleConfigOption(CommandLine cmd);  }