ArgScanner { public boolean parse(Iterable<String> args) { return parse(ArgFilters.SELECT_ALL, ImmutableList.copyOf(args)); } ArgScanner();  ArgScanner(PrintStream out); boolean parse(Iterable<String> args); boolean parse(Predicate<Field> filter, Iterable<String> args); boolean parse(ArgsInfo argsInfo, Iterable<String> args);  }
@Test public void testHelp() { assertFalse(parse(StandardArgs.class, "-h")); assertFalse(parse(StandardArgs.class, "-help")); }
@Test public void testAllowsEmptyString() { parse(StandardArgs.class, "-string="); assertThat(StandardArgs.STRING_VAL.get(), is("")); resetArgs(StandardArgs.class); parse(StandardArgs.class, "-string=''"); assertThat(StandardArgs.STRING_VAL.get(), is("")); resetArgs(StandardArgs.class); parse(StandardArgs.class, "-string=\"\""); assertThat(StandardArgs.STRING_VAL.get(), is("")); }
@Test(expected = IllegalArgumentException.class) public void testShortHelpReserved() { parse(ShortHelpArg.class); }
@Test(expected = IllegalArgumentException.class) public void testLongHelpReserved() { parse(LongHelpArg.class); }
@Test(expected = IllegalArgumentException.class) public void testRejectsDuplicates() { parse(DuplicateNames.class, "-string-str"); }
@Test public void testRequiredProvided() { parse(OneRequired.class, "-string2=blah"); }
@Test(expected = IllegalArgumentException.class) public void testMissingRequired() { parse(OneRequired.class, "-string1=blah"); }
@Test(expected = IllegalArgumentException.class) public void testUnrecognizedArg() { parse(OneRequired.class, "-string2=blah", "-string3=blah"); }
@Test(expected = IllegalArgumentException.class) public void testDisallowsShortNameOnArgCollision() { parse(ImmutableList.of(NameClashA.class, NameClashB.class), "-string=blah"); }
@Test(expected = IllegalArgumentException.class) public void testDisallowsShortNegNameOnArgCollision() { parse(ImmutableList.of(NameClashA.class, NameClashB.class), "-no_boolean"); }
@Test(expected = IllegalArgumentException.class) public void testBadUnitType() { parse(ImmutableList.of(AmountContainer.class), "-time_amount=1Mb"); }
@Test(expected = IllegalArgumentException.class) public void testUnrecognizedUnitType() { parse(ImmutableList.of(AmountContainer.class), "-time_amount=1abcd"); }