ConfigBuilderArgParser extends ArgParser<ConfigBuilder> { public boolean validateArgs(CommandLine cli) throws IllegalArgumentException { if (archive && run) { throw new IllegalArgumentException("Specify either -run or -createipa/-archive, not both"); } else { if (cli.getOptions() == null || cli.getOptions().length == 0 ) { return false; } else { if (cli.getOptionValue(CLASSPATH) == null) { return false; } } } return true; } ConfigBuilderArgParser(Options options, String[] args); @Override ConfigBuilder populateObject(ConfigBuilder configBuilder); ConfigBuilder processArg(Option option, String argName,ConfigBuilder configBuilder); ConfigBuilder setResources(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setFrameworks(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setWeakFrameworks(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setUnhideSymbols(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setExportedSymbols(ConfigBuilder configBuilder, List<String> values); void printVersionAndExit(); ConfigBuilder setVerbose(ConfigBuilder configBuilder); ConfigBuilder setThreads(ConfigBuilder configBuilder, String value); ConfigBuilder setForceLink(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setTreeshake(ConfigBuilder configBuilder, String value); ConfigBuilder dumpConfiguration(ConfigBuilder configBuilder, String value); ConfigBuilder dumpIntermediates(ConfigBuilder configBuilder); ConfigBuilder skipRuntime(ConfigBuilder configBuilder); ConfigBuilder enableDynamicJNI(ConfigBuilder configBuilder); ConfigBuilder setConfig(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setRun(ConfigBuilder configBuilder); ConfigBuilder setOutBin(ConfigBuilder configBuilder, String value); ConfigBuilder setProperties(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setJar(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setDebugLibs(ConfigBuilder configBuilder); @Override void usage(Options options); ConfigBuilder setLibs(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setTemp(ConfigBuilder configBuilder, String value); ConfigBuilder setHome(ConfigBuilder configBuilder, String value); ConfigBuilder setCCompiler(ConfigBuilder configBuilder, String value); ConfigBuilder enableClean(ConfigBuilder configBuilder); ConfigBuilder setCache(ConfigBuilder configBuilder, String value); void invalidOption(Option option); ConfigBuilder setOutDir(ConfigBuilder configBuilder, String value); ConfigBuilder setClasspath(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setBootClass(ConfigBuilder configBuilder, List<String> values); ConfigBuilder setBuildAsLib(ConfigBuilder configBuilder); boolean validateArgs(CommandLine cli);  }
@Test public void testValidateArgs() throws ParseException { CommandLineParser commandLineParser = new DefaultParser(); CommandLine cmd = commandLineParser.parse( options, new String[]{}); assert(!configBuilderArgParser.validateArgs(cmd)); cmd = commandLineParser.parse( options, new String[]{"-c", "/tmp/classPath"}); assert(configBuilderArgParser.validateArgs(cmd)); }