Skip to content

Commit

Permalink
[#1471] separate tests for static and dynamic hierarchy
Browse files Browse the repository at this point in the history
  • Loading branch information
remkop committed Jul 19, 2022
1 parent 675327c commit 6f855a9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/test/java/picocli/Issue1471.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public CommandLine getTestCommandLine(ParentTestCommand parentCommand, TestComma
static class ParentTestCommand {
}

@Command(name = "parentTestCommand", mixinStandardHelpOptions = true, scope = INHERIT,
subcommands = TestCommand.class)
static class ParentTestCommand2 {
}

@Command(name = "sorteotest")
static class TestCommand {
@Command(name = "entertest", description = "Start participating in a giveaway")
Expand All @@ -29,9 +34,14 @@ void enter(@Parameters(arity = "1") String sentenceType,

@Ignore
@Test
public void testIssue1741() {
public void testIssue1741_subcommandAddedProgrammatically() {
CommandLine commandLine = getTestCommandLine(new ParentTestCommand(), new TestCommand(), CommandLine.defaultFactory());
assertEquals(0, commandLine.execute("sorteotest", "entertest", "sequenceType", "url"));
}

@Test
public void testIssue1741_staticHierarchy() {
CommandLine commandLine = new CommandLine(new ParentTestCommand2());
assertEquals(0, commandLine.execute("sorteotest", "entertest", "sequenceType", "url"));
}
}

0 comments on commit 6f855a9

Please sign in to comment.