use of io.vertx.core.cli.Argument in project vert.x by eclipse.
the class DefaultParserTest method testThatOnlyOneArgumentCanBeMultivalued.
@Test(expected = CLIException.class)
public void testThatOnlyOneArgumentCanBeMultivalued() {
CLI cli = new DefaultCLI().setName("test");
cli.addArgument(new Argument().setIndex(0));
cli.addArgument(new Argument().setIndex(1).setMultiValued(true));
cli.addArgument(new Argument().setIndex(2).setMultiValued(true));
cli.parse(Arrays.asList("a", "b", "c", "d"));
}
use of io.vertx.core.cli.Argument in project vert.x by eclipse.
the class DefaultParserTest method testThatArgumentIndexCanBeGeneratedWithPartiallyNumberedArguments.
@Test
public void testThatArgumentIndexCanBeGeneratedWithPartiallyNumberedArguments() {
CLI cli = new DefaultCLI().setName("test");
cli.addArgument(new Argument());
cli.addArgument(new Argument().setIndex(1));
cli.addArgument(new Argument().setMultiValued(true));
CommandLine line = cli.parse(Arrays.asList("a", "b", "c", "d"));
assertThat((String) line.getArgumentValue(0)).isEqualToIgnoringCase("a");
assertThat((String) line.getArgumentValue(1)).isEqualToIgnoringCase("b");
assertThat(line.getArgumentValues(2)).containsExactly("c", "d");
}