@Test public void handleTemplate() { OptionParser optionParser = new OptionParser(); Path dir = optionParser.handleTemplateOption(cmd); assertEquals(templateDir.toString(), dir.toString()); }
public Path handleTemplateOption(CommandLine cmd) { Path templatePath = Paths.get(cmd.getOptionValue("t")); if (!templatePath.toFile().isDirectory()) { throw new IllegalArgumentException("the input template path does not point to a local directory."); } System.out.print("Valid template path: "); System.out.println(cmd.getOptionValue("t")); return templatePath; }
OptionParser { public Path handleTemplateOption(CommandLine cmd) { Path templatePath = Paths.get(cmd.getOptionValue("t")); if (!templatePath.toFile().isDirectory()) { throw new IllegalArgumentException("the input template path does not point to a local directory."); } System.out.print("Valid template path: "); System.out.println(cmd.getOptionValue("t")); return templatePath; } }
OptionParser { public Path handleTemplateOption(CommandLine cmd) { Path templatePath = Paths.get(cmd.getOptionValue("t")); if (!templatePath.toFile().isDirectory()) { throw new IllegalArgumentException("the input template path does not point to a local directory."); } System.out.print("Valid template path: "); System.out.println(cmd.getOptionValue("t")); return templatePath; } OptionParser(); }
OptionParser { public Path handleTemplateOption(CommandLine cmd) { Path templatePath = Paths.get(cmd.getOptionValue("t")); if (!templatePath.toFile().isDirectory()) { throw new IllegalArgumentException("the input template path does not point to a local directory."); } System.out.print("Valid template path: "); System.out.println(cmd.getOptionValue("t")); return templatePath; } OptionParser(); Options getOptions(); Path handleTemplateOption(CommandLine cmd); Path handleConfigOption(CommandLine cmd); }
OptionParser { public Path handleTemplateOption(CommandLine cmd) { Path templatePath = Paths.get(cmd.getOptionValue("t")); if (!templatePath.toFile().isDirectory()) { throw new IllegalArgumentException("the input template path does not point to a local directory."); } System.out.print("Valid template path: "); System.out.println(cmd.getOptionValue("t")); return templatePath; } OptionParser(); Options getOptions(); Path handleTemplateOption(CommandLine cmd); Path handleConfigOption(CommandLine cmd);  }