Java Code Examples for picocli.CommandLine.Model.CommandSpec#addMethodSubcommands()
The following examples show how to use
picocli.CommandLine.Model.CommandSpec#addMethodSubcommands() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommandMethodTest.java From picocli with Apache License 2.0 | 5 votes |
@Test public void testAddMethodSubcommands() { CommandSpec spec = CommandSpec.wrapWithoutInspection(new StaticMethodCommand(1)); assertEquals(0, spec.subcommands().size()); spec.addMethodSubcommands(); assertEquals(4, spec.subcommands().size()); }
Example 2
Source File: CommandMethodTest.java From picocli with Apache License 2.0 | 5 votes |
@Test public void testAddMethodSubcommands_DisallowedIfUserObjectIsMethod() throws Exception { Method m = MethodApp.class.getDeclaredMethod("run1", int.class); CommandSpec spec = CommandSpec.wrapWithoutInspection(m); try { spec.addMethodSubcommands(); } catch (InitializationException ex) { assertEquals("Cannot discover subcommand methods of this Command Method: int picocli.CommandMethodTest$MethodApp.run1(int)", ex.getMessage()); } }