@Test public void testNewAPI() throws Exception { String[] args = { "-config", this.configFile.getAbsolutePath(), "-spec", this.v3ApiRequestFile.getAbsolutePath(), "-output", this.outputFile.getAbsolutePath() }; Main.runMain(args); new ImageSimilarity(getFile("expectedV3Image.png")) .assertSimilarity(this.outputFile, 10); }
@VisibleForTesting public static void runMain(final String[] args) throws Exception { final CliHelpDefinition helpCli = new CliHelpDefinition(); try { Args.parse(helpCli, args); if (helpCli.help) { printUsage(0); return; } } catch (IllegalArgumentException invalidOption) { } final CliDefinition cli = new CliDefinition(); try { List<String> unusedArguments = Args.parse(cli, args); if (!unusedArguments.isEmpty()) { System.out.println("\n\nThe following arguments are not recognized: " + unusedArguments); printUsage(1); return; } } catch (IllegalArgumentException invalidOption) { System.out.println("\n\n" + invalidOption.getMessage()); printUsage(1); return; } configureLogs(cli.verbose); AbstractXmlApplicationContext context = new ClassPathXmlApplicationContext(DEFAULT_SPRING_CONTEXT); if (cli.springConfig != null) { context = new ClassPathXmlApplicationContext(DEFAULT_SPRING_CONTEXT, cli.springConfig); } try { context.getBean(Main.class).run(cli); } finally { context.close(); } }
Main { @VisibleForTesting public static void runMain(final String[] args) throws Exception { final CliHelpDefinition helpCli = new CliHelpDefinition(); try { Args.parse(helpCli, args); if (helpCli.help) { printUsage(0); return; } } catch (IllegalArgumentException invalidOption) { } final CliDefinition cli = new CliDefinition(); try { List<String> unusedArguments = Args.parse(cli, args); if (!unusedArguments.isEmpty()) { System.out.println("\n\nThe following arguments are not recognized: " + unusedArguments); printUsage(1); return; } } catch (IllegalArgumentException invalidOption) { System.out.println("\n\n" + invalidOption.getMessage()); printUsage(1); return; } configureLogs(cli.verbose); AbstractXmlApplicationContext context = new ClassPathXmlApplicationContext(DEFAULT_SPRING_CONTEXT); if (cli.springConfig != null) { context = new ClassPathXmlApplicationContext(DEFAULT_SPRING_CONTEXT, cli.springConfig); } try { context.getBean(Main.class).run(cli); } finally { context.close(); } } }
Main { @VisibleForTesting public static void runMain(final String[] args) throws Exception { final CliHelpDefinition helpCli = new CliHelpDefinition(); try { Args.parse(helpCli, args); if (helpCli.help) { printUsage(0); return; } } catch (IllegalArgumentException invalidOption) { } final CliDefinition cli = new CliDefinition(); try { List<String> unusedArguments = Args.parse(cli, args); if (!unusedArguments.isEmpty()) { System.out.println("\n\nThe following arguments are not recognized: " + unusedArguments); printUsage(1); return; } } catch (IllegalArgumentException invalidOption) { System.out.println("\n\n" + invalidOption.getMessage()); printUsage(1); return; } configureLogs(cli.verbose); AbstractXmlApplicationContext context = new ClassPathXmlApplicationContext(DEFAULT_SPRING_CONTEXT); if (cli.springConfig != null) { context = new ClassPathXmlApplicationContext(DEFAULT_SPRING_CONTEXT, cli.springConfig); } try { context.getBean(Main.class).run(cli); } finally { context.close(); } } private  Main(); }
Main { @VisibleForTesting public static void runMain(final String[] args) throws Exception { final CliHelpDefinition helpCli = new CliHelpDefinition(); try { Args.parse(helpCli, args); if (helpCli.help) { printUsage(0); return; } } catch (IllegalArgumentException invalidOption) { } final CliDefinition cli = new CliDefinition(); try { List<String> unusedArguments = Args.parse(cli, args); if (!unusedArguments.isEmpty()) { System.out.println("\n\nThe following arguments are not recognized: " + unusedArguments); printUsage(1); return; } } catch (IllegalArgumentException invalidOption) { System.out.println("\n\n" + invalidOption.getMessage()); printUsage(1); return; } configureLogs(cli.verbose); AbstractXmlApplicationContext context = new ClassPathXmlApplicationContext(DEFAULT_SPRING_CONTEXT); if (cli.springConfig != null) { context = new ClassPathXmlApplicationContext(DEFAULT_SPRING_CONTEXT, cli.springConfig); } try { context.getBean(Main.class).run(cli); } finally { context.close(); } } private  Main(); static void main(final String[] args); @VisibleForTesting static void runMain(final String[] args); }
Main { @VisibleForTesting public static void runMain(final String[] args) throws Exception { final CliHelpDefinition helpCli = new CliHelpDefinition(); try { Args.parse(helpCli, args); if (helpCli.help) { printUsage(0); return; } } catch (IllegalArgumentException invalidOption) { } final CliDefinition cli = new CliDefinition(); try { List<String> unusedArguments = Args.parse(cli, args); if (!unusedArguments.isEmpty()) { System.out.println("\n\nThe following arguments are not recognized: " + unusedArguments); printUsage(1); return; } } catch (IllegalArgumentException invalidOption) { System.out.println("\n\n" + invalidOption.getMessage()); printUsage(1); return; } configureLogs(cli.verbose); AbstractXmlApplicationContext context = new ClassPathXmlApplicationContext(DEFAULT_SPRING_CONTEXT); if (cli.springConfig != null) { context = new ClassPathXmlApplicationContext(DEFAULT_SPRING_CONTEXT, cli.springConfig); } try { context.getBean(Main.class).run(cli); } finally { context.close(); } } private  Main(); static void main(final String[] args); @VisibleForTesting static void runMain(final String[] args); static final String DEFAULT_SPRING_CONTEXT; }