()
| 431 | } |
| 432 | |
| 433 | @Test |
| 434 | public void testReflection() { |
| 435 | class All { |
| 436 | @Option(names = "-x", required = true) int x; |
| 437 | @Option(names = "-y", required = true) int y; |
| 438 | } |
| 439 | class App { |
| 440 | @ArgGroup All all; |
| 441 | } |
| 442 | CommandLine cmd = new CommandLine(new App(), new InnerClassFactory(this)); |
| 443 | CommandSpec spec = cmd.getCommandSpec(); |
| 444 | List<ArgGroupSpec> groups = spec.argGroups(); |
| 445 | assertEquals(1, groups.size()); |
| 446 | |
| 447 | ArgGroupSpec group = groups.get(0); |
| 448 | assertNotNull(group); |
| 449 | |
| 450 | List<ArgSpec> options = new ArrayList<ArgSpec>(group.args()); |
| 451 | assertEquals(2, options.size()); |
| 452 | assertEquals("-x", ((OptionSpec) options.get(0)).shortestName()); |
| 453 | assertEquals("-y", ((OptionSpec) options.get(1)).shortestName()); |
| 454 | |
| 455 | assertNotNull(options.get(0).group()); |
| 456 | assertSame(group, options.get(0).group()); |
| 457 | |
| 458 | assertNotNull(options.get(1).group()); |
| 459 | assertSame(group, options.get(1).group()); |
| 460 | } |
| 461 | |
| 462 | @Test |
| 463 | public void testReflectionRequiresNonEmpty() { |
nothing calls this directly
no test coverage detected