garydgregory commented on code in PR #229:
URL: https://github.com/apache/commons-cli/pull/229#discussion_r1491025523
##########
src/test/java/org/apache/commons/cli/CommandLineTest.java:
##########
@@ -166,7 +166,27 @@ public void testGetParsedOptionValueWithOption() throws
Exception {
}
@Test
- public void testNullhOption() throws Exception {
+ public void testGetParsedOptionValueUsingDefault() throws Exception {
+ final Options options = new Options();
+ final Option optI =
Option.builder("i").hasArg().type(Number.class).build();
+ final Option optF = Option.builder("f").hasArg().build();
+ options.addOption(optI);
+ options.addOption(optF);
+
+ final CommandLineParser parser = new DefaultParser();
+ final CommandLine cmd = parser.parse(options, new String[] {"-i",
"123"});
+
+ assertEquals(123, ((Number)
cmd.getParsedOptionValue(optI)).intValue());
+ assertEquals("foo", cmd.getParsedOptionValue(optF, "foo"));
+ assertEquals("foo", cmd.getParsedOptionValue(optF, ()-> "foo"));
Review Comment:
> If you know how to fix the checkstyle to look for this error I would
appreciate it.
Hi @Claudenw
Done. Please rebase on git master.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]