CliCupInvoker { @VisibleForTesting static String[] buildArgv( String javaPackage, File outputDirectory, String parserClassName, String symClassName, boolean symbolInterface, String cupFileName) { ArgBuilder args = new ArgBuilder(); if (!Strings.isNullOrEmpty(javaPackage)) { args.addOption("package", javaPackage); } args.addOption("destdir", outputDirectory.getAbsolutePath()); args.addOption("parser", parserClassName); args.addOption("symbols", symClassName); if (symbolInterface) { args.addOption("interface"); } args.addArg(cupFileName); return args.buildArray(); } CliCupInvoker(Log log);   }
@Test public void buildArgv() throws Exception { assertThat( ImmutableList.copyOf( CliCupInvoker.buildArgv( "foo.bar", new File("/outputDirectory"), "Parser", "Symbols", true, "/a/b/c/def.cup"))) .containsExactly( "-package", "foo.bar", "-destdir", "/outputDirectory", "-parser", "Parser", "-symbols", "Symbols", "-interface", "/a/b/c/def.cup") .inOrder(); }