-
Notifications
You must be signed in to change notification settings - Fork 440
Closed
Labels
theme: parserAn issue or change related to the parserAn issue or change related to the parsertype: bug 🐛
Milestone
Description
Test to reproduce the issue:
@Command(name = "test-composite")
static class TestComposite {
@ArgGroup(exclusive = false, multiplicity = "0..*")
List<OuterGroup> outerList;
static class OuterGroup {
@Option(names = "--add-group", required = true) boolean addGroup;
@ArgGroup(exclusive = false, multiplicity = "1")
Inner inner;
static class Inner {
@Option(names = "--option1", required = true) String option1;
@Option(names = "--option2", required = true) String option2;
}
}
}
@Test
public void testCompositeValidation() {
TestComposite app = new TestComposite();
CommandLine cmd = new CommandLine(app);
try {
ParseResult parseResult = cmd.parseArgs("--add-group", "--option2=1", "--option1=1", "--add-group");
fail("Expect exception");
} catch (MissingParameterException ex) {
assertEquals("Error: Missing required argument(s): [--add-group (--option1=<option1> --option2=<option2>)]...", ex.getMessage());
}
}
Metadata
Metadata
Assignees
Labels
theme: parserAn issue or change related to the parserAn issue or change related to the parsertype: bug 🐛