You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/08/10 13:00:46 UTC

(commons-cli) branch master updated (46f185d -> 595c54b)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-cli.git


    from 46f185d  Bump github/codeql-action from 3.25.15 to 3.26.0 (#297)
     new a78cff6  Better param name
     new d6c2e6b  Remove redundant keyword
     new 4c6404c  Better parameter name
     new c9c933e  Better parameter name
     new ab4fed2  Better parameter name
     new 25b52e4  Better parameter name
     new 7ecbc0c  Sort members
     new bf4440d  Better parameter name
     new 595c54b  Prepare for the next release candidate

The 9 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CONTRIBUTING.md                                    |    9 +-
 README.md                                          |   12 +-
 RELEASE-NOTES.txt                                  |   42 +
 src/changes/changes.xml                            |    2 +-
 .../java/org/apache/commons/cli/HelpFormatter.java |   34 +-
 src/main/java/org/apache/commons/cli/Option.java   |   24 +-
 src/site/xdoc/download_cli.xml                     |   26 +-
 .../org/apache/commons/cli/CommandLineTest.java    | 1064 ++++++++++----------
 8 files changed, 628 insertions(+), 585 deletions(-)


(commons-cli) 04/09: Better parameter name

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-cli.git

commit c9c933e873457fd2d4fe7914491928929bbea66c
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Aug 10 08:51:28 2024 -0400

    Better parameter name
    
    Better instance variable name
---
 src/main/java/org/apache/commons/cli/HelpFormatter.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/commons/cli/HelpFormatter.java b/src/main/java/org/apache/commons/cli/HelpFormatter.java
index 39e3892..c62967f 100644
--- a/src/main/java/org/apache/commons/cli/HelpFormatter.java
+++ b/src/main/java/org/apache/commons/cli/HelpFormatter.java
@@ -302,7 +302,7 @@ public class HelpFormatter {
     /**
      * Function to format the description for a deprecated option.
      */
-    private final Function<Option, String> deprecatedFormatFunc;
+    private final Function<Option, String> deprecatedFormatFunction;
 
     /**
      * Where to print help.
@@ -328,10 +328,10 @@ public class HelpFormatter {
      * Constructs a new instance.
      * @param printWriter TODO
      */
-    private HelpFormatter(final Function<Option, String> deprecatedFormatFunc, final PrintWriter printWriter, final boolean showSince) {
+    private HelpFormatter(final Function<Option, String> deprecatedFormatFunction, final PrintWriter printWriter, final boolean showSince) {
         // TODO All other instance HelpFormatter instance variables.
         // Make HelpFormatter immutable for 2.0
-        this.deprecatedFormatFunc = deprecatedFormatFunc;
+        this.deprecatedFormatFunction = deprecatedFormatFunction;
         this.printWriter = printWriter;
         this.showSince = showSince;
     }
@@ -464,8 +464,8 @@ public class HelpFormatter {
             }
             optBuf.append(dpad);
 
-            if (deprecatedFormatFunc != null && option.isDeprecated()) {
-                optBuf.append(deprecatedFormatFunc.apply(option).trim());
+            if (deprecatedFormatFunction != null && option.isDeprecated()) {
+                optBuf.append(deprecatedFormatFunction.apply(option).trim());
             } else if (option.getDescription() != null) {
                 optBuf.append(option.getDescription());
             }


(commons-cli) 03/09: Better parameter name

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-cli.git

commit 4c6404c6820a7a6ebe7ee8956d1bf2d8d8cd5c4c
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Aug 10 08:50:28 2024 -0400

    Better parameter name
---
 src/main/java/org/apache/commons/cli/HelpFormatter.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/commons/cli/HelpFormatter.java b/src/main/java/org/apache/commons/cli/HelpFormatter.java
index 6593057..39e3892 100644
--- a/src/main/java/org/apache/commons/cli/HelpFormatter.java
+++ b/src/main/java/org/apache/commons/cli/HelpFormatter.java
@@ -326,13 +326,13 @@ public class HelpFormatter {
 
     /**
      * Constructs a new instance.
-     * @param printStream TODO
+     * @param printWriter TODO
      */
-    private HelpFormatter(final Function<Option, String> deprecatedFormatFunc, final PrintWriter printStream, final boolean showSince) {
+    private HelpFormatter(final Function<Option, String> deprecatedFormatFunc, final PrintWriter printWriter, final boolean showSince) {
         // TODO All other instance HelpFormatter instance variables.
         // Make HelpFormatter immutable for 2.0
         this.deprecatedFormatFunc = deprecatedFormatFunc;
-        this.printWriter = printStream;
+        this.printWriter = printWriter;
         this.showSince = showSince;
     }
 


(commons-cli) 02/09: Remove redundant keyword

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-cli.git

commit d6c2e6ba813e155b1b6f217a642ec5988c483a1c
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Aug 10 08:49:23 2024 -0400

    Remove redundant keyword
---
 src/main/java/org/apache/commons/cli/Option.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/cli/Option.java b/src/main/java/org/apache/commons/cli/Option.java
index 170d884..2e49cdb 100644
--- a/src/main/java/org/apache/commons/cli/Option.java
+++ b/src/main/java/org/apache/commons/cli/Option.java
@@ -257,8 +257,8 @@ public class Option implements Cloneable, Serializable {
          * @return this builder.
          */
         public Builder optionalArg(final boolean optionalArg) {
-            if (optionalArg && this.argCount == UNINITIALIZED) {
-                this.argCount = 1;
+            if (optionalArg && argCount == UNINITIALIZED) {
+                argCount = 1;
             }
             this.optionalArg = optionalArg;
             return this;


(commons-cli) 08/09: Better parameter name

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-cli.git

commit bf4440d6b58f5fb2b3771e4f72a842a8eb441222
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Aug 10 08:58:44 2024 -0400

    Better parameter name
---
 src/main/java/org/apache/commons/cli/HelpFormatter.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/commons/cli/HelpFormatter.java b/src/main/java/org/apache/commons/cli/HelpFormatter.java
index 5d0bd75..2e86455 100644
--- a/src/main/java/org/apache/commons/cli/HelpFormatter.java
+++ b/src/main/java/org/apache/commons/cli/HelpFormatter.java
@@ -947,28 +947,28 @@ public class HelpFormatter {
      * Renders the specified text width a maximum width. This method differs from renderWrappedText by not removing leading
      * spaces after a new line.
      *
-     * @param sb The StringBuffer to place the rendered text into.
+     * @param appendable The StringBuffer to place the rendered text into.
      * @param width The number of characters to display per line
      * @param nextLineTabStop The position on the next line for the first tab.
      * @param text The text to be rendered.
      */
-    private <A extends Appendable> A renderWrappedTextBlock(final A sb, final int width, final int nextLineTabStop, final String text) {
+    private <A extends Appendable> A renderWrappedTextBlock(final A appendable, final int width, final int nextLineTabStop, final String text) {
         try {
             final BufferedReader in = new BufferedReader(new StringReader(text));
             String line;
             boolean firstLine = true;
             while ((line = in.readLine()) != null) {
                 if (!firstLine) {
-                    sb.append(getNewLine());
+                    appendable.append(getNewLine());
                 } else {
                     firstLine = false;
                 }
-                appendWrappedText(sb, width, nextLineTabStop, line);
+                appendWrappedText(appendable, width, nextLineTabStop, line);
             }
         } catch (final IOException e) { // NOPMD
             // cannot happen
         }
-        return sb;
+        return appendable;
     }
 
     /**


(commons-cli) 06/09: Better parameter name

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-cli.git

commit 25b52e4deac5cec186ba71e85b467404c755c9f3
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Aug 10 08:53:14 2024 -0400

    Better parameter name
    
    Better instance variable name
---
 src/main/java/org/apache/commons/cli/Option.java | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/commons/cli/Option.java b/src/main/java/org/apache/commons/cli/Option.java
index 2e49cdb..d2c6f5c 100644
--- a/src/main/java/org/apache/commons/cli/Option.java
+++ b/src/main/java/org/apache/commons/cli/Option.java
@@ -417,7 +417,7 @@ public class Option implements Cloneable, Serializable {
     private List<String> values = new ArrayList<>();
 
     /** The character that is the value separator. */
-    private char valuesep;
+    private char valueSeparator;
 
     /**
      * Private constructor used by the nested Builder class.
@@ -435,7 +435,7 @@ public class Option implements Cloneable, Serializable {
         this.required = builder.required;
         this.since = builder.since;
         this.type = builder.type;
-        this.valuesep = builder.valueSeparator;
+        this.valueSeparator = builder.valueSeparator;
         this.converter = builder.converter;
     }
 
@@ -727,7 +727,7 @@ public class Option implements Cloneable, Serializable {
      * @return the value separator character.
      */
     public char getValueSeparator() {
-        return valuesep;
+        return valueSeparator;
     }
 
     /**
@@ -805,7 +805,7 @@ public class Option implements Cloneable, Serializable {
      * @since 1.1
      */
     public boolean hasValueSeparator() {
-        return valuesep > 0;
+        return valueSeparator > 0;
     }
 
     /**
@@ -969,10 +969,10 @@ public class Option implements Cloneable, Serializable {
     /**
      * Sets the value separator. For example if the argument value was a Java property, the value separator would be '='.
      *
-     * @param sep The value separator.
+     * @param valueSeparator The value separator.
      */
-    public void setValueSeparator(final char sep) {
-        this.valuesep = sep;
+    public void setValueSeparator(final char valueSeparator) {
+        this.valueSeparator = valueSeparator;
     }
 
     String toDeprecatedString() {


(commons-cli) 07/09: Sort members

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-cli.git

commit 7ecbc0ce89af46b513169e149fba8657430303a0
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Aug 10 08:53:36 2024 -0400

    Sort members
---
 .../org/apache/commons/cli/CommandLineTest.java    | 1064 ++++++++++----------
 1 file changed, 532 insertions(+), 532 deletions(-)

diff --git a/src/test/java/org/apache/commons/cli/CommandLineTest.java b/src/test/java/org/apache/commons/cli/CommandLineTest.java
index 31998da..6fefd89 100644
--- a/src/test/java/org/apache/commons/cli/CommandLineTest.java
+++ b/src/test/java/org/apache/commons/cli/CommandLineTest.java
@@ -41,280 +41,149 @@ public class CommandLineTest {
 
     private enum Count { ONE, TWO, THREE }
 
-    @Test
-    public void testBuilder() {
-        final CommandLine.Builder builder = new CommandLine.Builder();
-        builder.addArg("foo").addArg("bar");
-        builder.addOption(Option.builder("T").build());
-        final CommandLine cmd = builder.build();
-
-        assertEquals("foo", cmd.getArgs()[0]);
-        assertEquals("bar", cmd.getArgList().get(1));
-        assertEquals("T", cmd.getOptions()[0].getOpt());
-    }
-
-    @Test
-    public void testBuilderNullArgs() {
-        final CommandLine.Builder builder = new CommandLine.Builder();
-        builder.addArg(null).addArg(null);
-        builder.addOption(Option.builder("T").build());
-        final CommandLine cmd = builder.build();
-
-        assertEquals(0, cmd.getArgs().length);
-        assertEquals("T", cmd.getOptions()[0].getOpt());
-    }
-
-    @Test
-    public void testBuilderNullOption() {
-        final CommandLine.Builder builder = new CommandLine.Builder();
-        builder.addArg("foo").addArg("bar");
-        builder.addOption(null);
-        builder.addOption(null);
-        builder.addOption(null);
-        final CommandLine cmd = builder.build();
+    private static Stream<Arguments> createHasOptionParameters() throws ParseException {
+        final List<Arguments> lst = new ArrayList<>();
+        final Option optT = Option.builder().option("T").longOpt("tee").deprecated().optionalArg(true).build();
+        final Option optU = Option.builder("U").longOpt("you").optionalArg(true).build();
+        final OptionGroup optionGroup = new OptionGroup().addOption(optT).addOption(optU);
 
-        assertEquals("foo", cmd.getArgs()[0]);
-        assertEquals("bar", cmd.getArgList().get(1));
-        assertEquals(0, cmd.getOptions().length);
-    }
+        final String[] foobar = { "foo", "bar" };
+        // T set
+        lst.add(Arguments.of(new String[] {"-T"}, optT, optionGroup, true, true, true, true, optT));
+        lst.add(Arguments.of(new String[] {"-T", "foo"}, optT, optionGroup, true, true, true, true, optT));
+        lst.add(Arguments.of(new String[] {"--tee"}, optT, optionGroup, true, true, true, true, optT));
+        lst.add(Arguments.of(new String[] {"--tee", "foo"}, optT, optionGroup, true, true, true, true, optT));
 
-    @Test
-    public void testGetOptionProperties() throws Exception {
-        final String[] args = {"-Dparam1=value1", "-Dparam2=value2", "-Dparam3", "-Dparam4=value4", "-D", "--property", "foo=bar"};
+        lst.add(Arguments.of(new String[] {"-U"}, optT, optionGroup, false, false, false, true, optU));
+        lst.add(Arguments.of(new String[] {"-U", "foo", "bar"}, optT, optionGroup, false, false, false, true, optU));
+        lst.add(Arguments.of(new String[] {"--you"}, optT, optionGroup, false, false, false, true, optU));
+        lst.add(Arguments.of(new String[] {"--you", "foo", "bar"}, optT, optionGroup, false, false, false, true, optU));
 
-        final Options options = new Options();
-        options.addOption(Option.builder("D").valueSeparator().optionalArg(true).numberOfArgs(2).build());
-        options.addOption(Option.builder().valueSeparator().numberOfArgs(2).longOpt("property").build());
 
-        final Parser parser = new GnuParser();
-        final CommandLine cl = parser.parse(options, args);
+        // U set
+        lst.add(Arguments.of(new String[] {"-T"}, optU, optionGroup, false, false, true, true, optT));
+        lst.add(Arguments.of(new String[] {"-T", "foo", "bar"}, optU, optionGroup, false, false, true, true, optT));
+        lst.add(Arguments.of(new String[] {"--tee"}, optU, optionGroup, false, false, true, true, optT));
+        lst.add(Arguments.of(new String[] {"--tee", "foo", "bar"}, optU, optionGroup, false, false, true, true, optT));
 
-        final Properties props = cl.getOptionProperties("D");
-        assertNotNull(props, "null properties");
-        assertEquals(4, props.size(), "number of properties in " + props);
-        assertEquals("value1", props.getProperty("param1"), "property 1");
-        assertEquals("value2", props.getProperty("param2"), "property 2");
-        assertEquals("true", props.getProperty("param3"), "property 3");
-        assertEquals("value4", props.getProperty("param4"), "property 4");
+        lst.add(Arguments.of(new String[] {"-U"}, optU, optionGroup, false, true, false, true, optU));
+        lst.add(Arguments.of(new String[] {"-U", "foo", "bar"}, optU, optionGroup, false, true, false, true, optU));
+        lst.add(Arguments.of(new String[] {"--you"}, optU, optionGroup, false, true, false, true, optU));
+        lst.add(Arguments.of(new String[] {"--you", "foo", "bar"},  optU, optionGroup, false, true, false, true, optU));
 
-        assertEquals("bar", cl.getOptionProperties("property").getProperty("foo"), "property with long format");
+        return lst.stream();
     }
 
-    @Test
-    public void testGetOptionPropertiesWithOption() throws Exception {
-        final String[] args = {"-Dparam1=value1", "-Dparam2=value2", "-Dparam3", "-Dparam4=value4", "-D", "--property", "foo=bar"};
-
-        final Options options = new Options();
-        final Option optionD = Option.builder("D").valueSeparator().numberOfArgs(2).optionalArg(true).build();
-        final Option optionProperty = Option.builder().valueSeparator().numberOfArgs(2).longOpt("property").build();
-        options.addOption(optionD);
-        options.addOption(optionProperty);
-
-        final Parser parser = new GnuParser();
-        final CommandLine cl = parser.parse(options, args);
-
-        final Properties props = cl.getOptionProperties(optionD);
-        assertNotNull(props, "null properties");
-        assertEquals(4, props.size(), "number of properties in " + props);
-        assertEquals("value1", props.getProperty("param1"), "property 1");
-        assertEquals("value2", props.getProperty("param2"), "property 2");
-        assertEquals("true", props.getProperty("param3"), "property 3");
-        assertEquals("value4", props.getProperty("param4"), "property 4");
-
-        assertEquals("bar", cl.getOptionProperties(optionProperty).getProperty("foo"), "property with long format");
-    }
+    private static Stream<Arguments> createOptionValueParameters() throws ParseException {
+        final List<Arguments> lst = new ArrayList<>();
+        final Option optT = Option.builder().option("T").longOpt("tee").deprecated().optionalArg(true).build();
+        final Option optU = Option.builder("U").longOpt("you").optionalArg(true).build();
+        final OptionGroup optionGroup = new OptionGroup().addOption(optT).addOption(optU);
 
-    @Test
-    public void testGetOptionsBuilder() {
-        final CommandLine cmd = CommandLine.builder().build();
-        assertNotNull(cmd.getOptions());
-        assertEquals(0, cmd.getOptions().length);
+        // T set
+        lst.add(Arguments.of(new String[] {"-T"}, optT, optionGroup, true, null, true, null, optT));
+        lst.add(Arguments.of(new String[] {"-T", "foo"}, optT, optionGroup, true, "foo", true, "foo", optT));
+        lst.add(Arguments.of(new String[] {"--tee"}, optT, optionGroup, true, null, true, null, optT));
+        lst.add(Arguments.of(new String[] {"--tee", "foo"}, optT, optionGroup, true, "foo", true, "foo", optT));
 
-        cmd.addOption(null);
-        cmd.addOption(new Option("a", null));
-        cmd.addOption(new Option("b", null));
-        cmd.addOption(new Option("c", null));
+        lst.add(Arguments.of(new String[] {"-U"}, optT, optionGroup, false, null, false, null, optU));
+        lst.add(Arguments.of(new String[] {"-U", "foo"}, optT, optionGroup, false, null, false, "foo", optU));
+        lst.add(Arguments.of(new String[] {"--you"}, optT, optionGroup, false, null, false, null, optU));
+        lst.add(Arguments.of(new String[] {"--you", "foo"}, optT, optionGroup, false, null, false, "foo", optU));
 
-        assertEquals(3, cmd.getOptions().length);
-    }
 
-    @Test
-    public void testGetOptionsCtor() {
-        final CommandLine cmd = new CommandLine();
-        assertNotNull(cmd.getOptions());
-        assertEquals(0, cmd.getOptions().length);
+        // U set
+        lst.add(Arguments.of(new String[] {"-T"}, optU, optionGroup, false, null, true, null, optT));
+        lst.add(Arguments.of(new String[] {"-T", "foo"}, optU, optionGroup, false, null, true, "foo", optT));
+        lst.add(Arguments.of(new String[] {"--tee"}, optU, optionGroup, false, null, true, null, optT));
+        lst.add(Arguments.of(new String[] {"--tee", "foo"}, optU, optionGroup, false, null, true, "foo", optT));
 
-        cmd.addOption(new Option("a", null));
-        cmd.addOption(new Option("b", null));
-        cmd.addOption(new Option("c", null));
-        cmd.addOption(null);
+        lst.add(Arguments.of(new String[] {"-U"}, optU, optionGroup, false, null, false, null, optU));
+        lst.add(Arguments.of(new String[] {"-U", "foo"}, optU, optionGroup, false, "foo", false, "foo", optU));
+        lst.add(Arguments.of(new String[] {"--you"}, optU, optionGroup, false, null, false, null, optU));
+        lst.add(Arguments.of(new String[] {"--you", "foo"},  optU, optionGroup, false, "foo", false, "foo", optU));
 
-        assertEquals(3, cmd.getOptions().length);
+        return lst.stream();
     }
 
-    @Test
-    public void testBadGetParsedOptionValue() throws Exception {
+    private static Stream<Arguments> createOptionValuesParameters() throws ParseException {
+        final List<Arguments> lst = new ArrayList<>();
+        final Option optT = Option.builder().option("T").longOpt("tee").numberOfArgs(2).deprecated().optionalArg(true).build();
+        final Option optU = Option.builder("U").longOpt("you").numberOfArgs(2).optionalArg(true).build();
+        final OptionGroup optionGroup = new OptionGroup().addOption(optT).addOption(optU);
 
-        final Options options = new Options();
-        options.addOption(Option.builder("i").hasArg().type(Number.class).build());
-        options.addOption(Option.builder("c").hasArg().converter(s -> Count.valueOf(s.toUpperCase())).build());
+        final String[] foobar = { "foo", "bar" };
+        // T set
+        lst.add(Arguments.of(new String[] {"-T"}, optT, optionGroup, true, null, true, null, optT));
+        lst.add(Arguments.of(new String[] {"-T", "foo", "bar"}, optT, optionGroup, true, foobar, true, foobar, optT));
+        lst.add(Arguments.of(new String[] {"--tee"}, optT, optionGroup, true, null, true, null, optT));
+        lst.add(Arguments.of(new String[] {"--tee", "foo", "bar"}, optT, optionGroup, true, foobar, true, foobar, optT));
 
+        lst.add(Arguments.of(new String[] {"-U"}, optT, optionGroup, false, null, false, null, optU));
+        lst.add(Arguments.of(new String[] {"-U", "foo", "bar"}, optT, optionGroup, false, null, false, foobar, optU));
+        lst.add(Arguments.of(new String[] {"--you"}, optT, optionGroup, false, null, false, null, optU));
+        lst.add(Arguments.of(new String[] {"--you", "foo", "bar"}, optT, optionGroup, false, null, false, foobar, optU));
 
-        final CommandLineParser parser = new DefaultParser();
-        final CommandLine cmd = parser.parse(options, new String[] {"-i", "foo", "-c", "bar"});
 
-        assertEquals(NumberFormatException.class, assertThrows(ParseException.class, () -> cmd.getParsedOptionValue("i")).getCause().getClass());
-        assertEquals(IllegalArgumentException.class, assertThrows(ParseException.class, () -> cmd.getParsedOptionValue("c")).getCause().getClass());
-    }
+        // U set
+        lst.add(Arguments.of(new String[] {"-T"}, optU, optionGroup, false, null, true, null, optT));
+        lst.add(Arguments.of(new String[] {"-T", "foo", "bar"}, optU, optionGroup, false, null, true, foobar, optT));
+        lst.add(Arguments.of(new String[] {"--tee"}, optU, optionGroup, false, null, true, null, optT));
+        lst.add(Arguments.of(new String[] {"--tee", "foo", "bar"}, optU, optionGroup, false, null, true, foobar, optT));
 
-    @Test
-    public void testNullOption() 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", "-f", "foo"});
-        assertNull(cmd.getOptionValue((Option) null));
-        assertNull(cmd.getParsedOptionValue((Option) null));
-        assertNull(cmd.getOptionValue((OptionGroup) null));
-        assertNull(cmd.getParsedOptionValue((OptionGroup) null));
-    }
+        lst.add(Arguments.of(new String[] {"-U"}, optU, optionGroup, false, null, false, null, optU));
+        lst.add(Arguments.of(new String[] {"-U", "foo", "bar"}, optU, optionGroup, false, foobar, false, foobar, optU));
+        lst.add(Arguments.of(new String[] {"--you"}, optU, optionGroup, false, null, false, null, optU));
+        lst.add(Arguments.of(new String[] {"--you", "foo", "bar"},  optU, optionGroup, false, foobar, false, foobar, optU));
 
-    private void assertWritten(final boolean optDep, final ByteArrayOutputStream baos) {
-        System.out.flush();
-        if (optDep) {
-            assertEquals("Option 'T''tee': Deprecated", baos.toString().trim());
-        } else {
-            assertEquals("", baos.toString());
-        }
-        baos.reset();
+        return lst.stream();
     }
 
-    @ParameterizedTest(name = "{0}, {1}")
-    @MethodSource("createOptionValueParameters")
-    public void noDeprecationHandlerTest(final String[] args, final Option opt, final OptionGroup optionGroup, final boolean optDep,
-                                   final String optValue, final boolean grpDep, final String grpValue, final Option grpOpt) throws ParseException {
-        final Options options = new Options().addOptionGroup(optionGroup);
-        final CommandLine commandLine = DefaultParser.builder().build().parse(options, args);
-        final Supplier<String> thinger = () -> "thing";
-        final Supplier<String> nullSupplier = null;
-        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        final PrintStream ps = System.out;
-        try {
-            System.setOut(new PrintStream(baos));
-
-            final OptionGroup otherGroup = new OptionGroup().addOption(Option.builder("o").longOpt("other").hasArg().build())
-                    .addOption(Option.builder().option("p").longOpt("part").hasArg().build());
-            final OptionGroup nullGroup = null;
-
-            // test char option
-            assertEquals(optValue, commandLine.getOptionValue(asChar(opt)));
-            assertWritten(optDep, baos);
-
-            assertEquals(optValue == null ? "thing" : optValue, commandLine.getOptionValue(asChar(opt), "thing"));
-            assertWritten(optDep, baos);
-
-            assertEquals(optValue == null ? "thing" : optValue, commandLine.getOptionValue(asChar(opt), thinger));
-            assertWritten(optDep, baos);
-
-            assertEquals(optValue, commandLine.getOptionValue(asChar(opt), nullSupplier));
-            assertWritten(optDep, baos);
-
-            // test short option arg
-            assertEquals(optValue, commandLine.getOptionValue(opt.getOpt()));
-            assertWritten(optDep, baos);
-
-            assertEquals(optValue == null ? "thing" : optValue, commandLine.getOptionValue(opt.getOpt(), "thing"));
-            assertWritten(optDep, baos);
-
-            assertEquals(optValue == null ? "thing" : optValue, commandLine.getOptionValue(opt.getOpt(), thinger));
-            assertWritten(optDep, baos);
-
-            assertEquals(optValue, commandLine.getOptionValue(opt.getOpt(), nullSupplier));
-            assertWritten(optDep, baos);
-
-            // test long option arg
-            assertEquals(optValue, commandLine.getOptionValue(opt.getLongOpt()));
-            assertWritten(optDep, baos);
-
-            assertEquals(optValue == null ? "thing" : optValue, commandLine.getOptionValue(opt.getLongOpt(), "thing"));
-            assertWritten(optDep, baos);
-
-            assertEquals(optValue == null ? "thing" : optValue, commandLine.getOptionValue(opt.getLongOpt(), thinger));
-            assertWritten(optDep, baos);
-
-            assertEquals(optValue, commandLine.getOptionValue(opt.getLongOpt(), nullSupplier));
-            assertWritten(optDep, baos);
-
-            // test Option arg
-            assertEquals(optValue, commandLine.getOptionValue(opt));
-            assertWritten(optDep, baos);
-
-            assertEquals(optValue == null ? "thing" : optValue, commandLine.getOptionValue(opt, "thing"));
-            assertWritten(optDep, baos);
-
-            assertEquals(optValue == null ? "thing" : optValue, commandLine.getOptionValue(opt, thinger));
-            assertWritten(optDep, baos);
-
-            assertEquals(optValue, commandLine.getOptionValue(opt, nullSupplier));
-            assertWritten(optDep, baos);
-
-            // test optionGroup  arg
-            assertEquals(grpValue, commandLine.getOptionValue(optionGroup));
-            assertWritten(grpDep, baos);
-
-            assertEquals(grpValue == null ? "thing" : grpValue, commandLine.getOptionValue(optionGroup, "thing"));
-            assertWritten(grpDep, baos);
-
-            assertEquals(grpValue == null ? "thing" : grpValue, commandLine.getOptionValue(optionGroup, thinger));
-            assertWritten(grpDep, baos);
-
-            assertEquals(grpValue, commandLine.getOptionValue(optionGroup, nullSupplier));
-            assertWritten(grpDep, baos);
-
-            // test other group arg
-            assertNull(commandLine.getOptionValue(otherGroup));
-            assertWritten(false, baos);
-
-            assertEquals("thing", commandLine.getOptionValue(otherGroup, "thing"));
-            assertWritten(false, baos);
-
-            assertEquals("thing", commandLine.getOptionValue(otherGroup, thinger));
-            assertWritten(false, baos);
-
-            assertNull(commandLine.getOptionValue(otherGroup, nullSupplier));
-            assertWritten(false, baos);
+    private static Stream<Arguments> createParsedOptionValueParameters() throws ParseException {
+        final List<Arguments> lst = new ArrayList<>();
+        final Option optT = Option.builder().option("T").longOpt("tee").deprecated().type(Integer.class).optionalArg(true).build();
+        final Option optU = Option.builder("U").longOpt("you").type(Integer.class).optionalArg(true).build();
+        final OptionGroup optionGroup = new OptionGroup().addOption(optT).addOption(optU);
+        final Integer expected = Integer.valueOf(1);
 
-            // test null Group arg
-            assertNull(commandLine.getOptionValue(nullGroup));
-            assertWritten(false, baos);
+        // T set
+        lst.add(Arguments.of(new String[] {"-T"}, optT, optionGroup, true, null, true, null, optT));
+        lst.add(Arguments.of(new String[] {"-T", "1"}, optT, optionGroup, true, expected, true, expected, optT));
+        lst.add(Arguments.of(new String[] {"--tee"}, optT, optionGroup, true, null, true, null, optT));
+        lst.add(Arguments.of(new String[] {"--tee", "1"}, optT, optionGroup, true, expected, true, expected, optT));
 
-            assertEquals("thing", commandLine.getOptionValue(nullGroup, "thing"));
-            assertWritten(false, baos);
+        lst.add(Arguments.of(new String[] {"-U"}, optT, optionGroup, false, null, false, null, optU));
+        lst.add(Arguments.of(new String[] {"-U", "1"}, optT, optionGroup, false, null, false, expected, optU));
+        lst.add(Arguments.of(new String[] {"--you"}, optT, optionGroup, false, null, false, null, optU));
+        lst.add(Arguments.of(new String[] {"--you", "1"}, optT, optionGroup, false, null, false, expected, optU));
 
-            assertEquals("thing", commandLine.getOptionValue(nullGroup, thinger));
-            assertWritten(false, baos);
 
-            assertNull(commandLine.getOptionValue(nullGroup, nullSupplier));
-            assertWritten(false, baos);
+        // U set
+        lst.add(Arguments.of(new String[] {"-T"}, optU, optionGroup, false, null, true, null, optT));
+        lst.add(Arguments.of(new String[] {"-T", "1"}, optU, optionGroup, false, null, true, expected, optT));
+        lst.add(Arguments.of(new String[] {"--tee"}, optU, optionGroup, false, null, true, null, optT));
+        lst.add(Arguments.of(new String[] {"--tee", "1"}, optU, optionGroup, false, null, true, expected, optT));
 
-            // test not an option
-            assertNull(commandLine.getOptionValue("Nope"));
-            assertWritten(false, baos);
+        lst.add(Arguments.of(new String[] {"-U"}, optU, optionGroup, false, null, false, null, optU));
+        lst.add(Arguments.of(new String[] {"-U", "1"}, optU, optionGroup, false, expected, false, expected, optU));
+        lst.add(Arguments.of(new String[] {"--you"}, optU, optionGroup, false, null, false, null, optU));
+        lst.add(Arguments.of(new String[] {"--you", "1"},  optU, optionGroup, false, expected, false, expected, optU));
 
-            assertEquals("thing", commandLine.getOptionValue("Nope", "thing"));
-            assertWritten(false, baos);
+        return lst.stream();
+    }
 
-            assertEquals("thing", commandLine.getOptionValue("Nope", thinger));
-            assertWritten(false, baos);
+    char asChar(final Option opt) {
+        return opt.getOpt().charAt(0);
+    }
 
-            assertNull(commandLine.getOptionValue("Nope", nullSupplier));
-            assertWritten(false, baos);
-        } finally {
-            System.setOut(ps);
+    private void assertWritten(final boolean optDep, final ByteArrayOutputStream baos) {
+        System.out.flush();
+        if (optDep) {
+            assertEquals("Option 'T''tee': Deprecated", baos.toString().trim());
+        } else {
+            assertEquals("", baos.toString());
         }
+        baos.reset();
     }
 
     /**
@@ -333,8 +202,62 @@ public class CommandLineTest {
         handler.clear();
     }
 
-    char asChar(final Option opt) {
-        return opt.getOpt().charAt(0);
+    /**
+     * Test for get option values with and without default values.  Verifies that deprecated options only report as
+     * deprecated once.
+     * @param args the argument strings to parse.
+     * @param opt the option to check for values with.
+     * @param optionGroup the option group to check for values with.
+     * @param optDep {@code true} if the opt is deprecated.
+     * @param optValue  The value expected from opt.
+     * @param grpDep {@code true} if the group is deprecated.
+     * @param grpValue the value expected from the group.
+     * @param grpOpt the option that is expected to be processed by the group.
+     * @throws ParseException on parse error.
+     */
+    @ParameterizedTest(name = "{0}, {1}")
+    @MethodSource("createOptionValuesParameters")
+    public void getOptionValuesTest(final String[] args, final Option opt, final OptionGroup optionGroup, final boolean optDep,
+                                    final String[] optValue, final boolean grpDep, final String[] grpValue, final Option grpOpt) throws ParseException {
+        final Options options = new Options().addOptionGroup(optionGroup);
+        final List<Option> handler = new ArrayList<>();
+        final CommandLine commandLine = DefaultParser.builder().setDeprecatedHandler(handler::add).build().parse(options, args);
+        final OptionGroup otherGroup = new OptionGroup().addOption(Option.builder("o").longOpt("other").hasArg().build())
+                .addOption(Option.builder().option("p").longOpt("part").hasArg().build());
+        final OptionGroup nullGroup = null;
+
+        // test char option arg
+        assertArrayEquals(optValue, commandLine.getOptionValues(asChar(opt)));
+        checkHandler(optDep, handler, opt);
+
+        // test short option arg
+        assertArrayEquals(optValue, commandLine.getOptionValues(opt.getOpt()));
+        checkHandler(optDep, handler, opt);
+
+        // test long option arg
+        assertArrayEquals(optValue, commandLine.getOptionValues(opt.getLongOpt()));
+        checkHandler(optDep, handler, opt);
+
+        // test Option arg
+        assertArrayEquals(optValue, commandLine.getOptionValues(opt));
+        checkHandler(optDep, handler, opt);
+
+
+        // test OptionGroup arg
+        assertArrayEquals(grpValue, commandLine.getOptionValues(optionGroup));
+        checkHandler(grpDep, handler, grpOpt);
+
+        // test not an option
+        assertNull(commandLine.getOptionValues("Nope"));
+        checkHandler(false, handler, opt);
+
+        // test other group arg
+        assertNull(commandLine.getOptionValues(otherGroup));
+        checkHandler(false, handler, grpOpt);
+
+        // test null group arg
+        assertNull(commandLine.getOptionValues(nullGroup));
+        checkHandler(false, handler, grpOpt);
     }
 
     /**
@@ -443,184 +366,99 @@ public class CommandLineTest {
         checkHandler(false, handler, opt);
     }
 
-    private static Stream<Arguments> createOptionValueParameters() throws ParseException {
-        final List<Arguments> lst = new ArrayList<>();
-        final Option optT = Option.builder().option("T").longOpt("tee").deprecated().optionalArg(true).build();
-        final Option optU = Option.builder("U").longOpt("you").optionalArg(true).build();
-        final OptionGroup optionGroup = new OptionGroup().addOption(optT).addOption(optU);
-
-        // T set
-        lst.add(Arguments.of(new String[] {"-T"}, optT, optionGroup, true, null, true, null, optT));
-        lst.add(Arguments.of(new String[] {"-T", "foo"}, optT, optionGroup, true, "foo", true, "foo", optT));
-        lst.add(Arguments.of(new String[] {"--tee"}, optT, optionGroup, true, null, true, null, optT));
-        lst.add(Arguments.of(new String[] {"--tee", "foo"}, optT, optionGroup, true, "foo", true, "foo", optT));
-
-        lst.add(Arguments.of(new String[] {"-U"}, optT, optionGroup, false, null, false, null, optU));
-        lst.add(Arguments.of(new String[] {"-U", "foo"}, optT, optionGroup, false, null, false, "foo", optU));
-        lst.add(Arguments.of(new String[] {"--you"}, optT, optionGroup, false, null, false, null, optU));
-        lst.add(Arguments.of(new String[] {"--you", "foo"}, optT, optionGroup, false, null, false, "foo", optU));
-
-
-        // U set
-        lst.add(Arguments.of(new String[] {"-T"}, optU, optionGroup, false, null, true, null, optT));
-        lst.add(Arguments.of(new String[] {"-T", "foo"}, optU, optionGroup, false, null, true, "foo", optT));
-        lst.add(Arguments.of(new String[] {"--tee"}, optU, optionGroup, false, null, true, null, optT));
-        lst.add(Arguments.of(new String[] {"--tee", "foo"}, optU, optionGroup, false, null, true, "foo", optT));
-
-        lst.add(Arguments.of(new String[] {"-U"}, optU, optionGroup, false, null, false, null, optU));
-        lst.add(Arguments.of(new String[] {"-U", "foo"}, optU, optionGroup, false, "foo", false, "foo", optU));
-        lst.add(Arguments.of(new String[] {"--you"}, optU, optionGroup, false, null, false, null, optU));
-        lst.add(Arguments.of(new String[] {"--you", "foo"},  optU, optionGroup, false, "foo", false, "foo", optU));
-
-        return lst.stream();
-    }
-
-
-    /**
-     * Test for get option values with and without default values.  Verifies that deprecated options only report as
-     * deprecated once.
-     * @param args the argument strings to parse.
-     * @param opt the option to check for values with.
-     * @param optionGroup the option group to check for values with.
-     * @param optDep {@code true} if the opt is deprecated.
-     * @param optValue  The value expected from opt.
-     * @param grpDep {@code true} if the group is deprecated.
-     * @param grpValue the value expected from the group.
-     * @param grpOpt the option that is expected to be processed by the group.
-     * @throws ParseException on parse error.
-     */
-    @ParameterizedTest(name = "{0}, {1}")
-    @MethodSource("createOptionValuesParameters")
-    public void getOptionValuesTest(final String[] args, final Option opt, final OptionGroup optionGroup, final boolean optDep,
-                                    final String[] optValue, final boolean grpDep, final String[] grpValue, final Option grpOpt) throws ParseException {
-        final Options options = new Options().addOptionGroup(optionGroup);
-        final List<Option> handler = new ArrayList<>();
-        final CommandLine commandLine = DefaultParser.builder().setDeprecatedHandler(handler::add).build().parse(options, args);
-        final OptionGroup otherGroup = new OptionGroup().addOption(Option.builder("o").longOpt("other").hasArg().build())
-                .addOption(Option.builder().option("p").longOpt("part").hasArg().build());
-        final OptionGroup nullGroup = null;
-
-        // test char option arg
-        assertArrayEquals(optValue, commandLine.getOptionValues(asChar(opt)));
-        checkHandler(optDep, handler, opt);
-
-        // test short option arg
-        assertArrayEquals(optValue, commandLine.getOptionValues(opt.getOpt()));
-        checkHandler(optDep, handler, opt);
-
-        // test long option arg
-        assertArrayEquals(optValue, commandLine.getOptionValues(opt.getLongOpt()));
-        checkHandler(optDep, handler, opt);
-
-        // test Option arg
-        assertArrayEquals(optValue, commandLine.getOptionValues(opt));
-        checkHandler(optDep, handler, opt);
-
-
-        // test OptionGroup arg
-        assertArrayEquals(grpValue, commandLine.getOptionValues(optionGroup));
-        checkHandler(grpDep, handler, grpOpt);
-
-        // test not an option
-        assertNull(commandLine.getOptionValues("Nope"));
-        checkHandler(false, handler, opt);
-
-        // test other group arg
-        assertNull(commandLine.getOptionValues(otherGroup));
-        checkHandler(false, handler, grpOpt);
-
-        // test null group arg
-        assertNull(commandLine.getOptionValues(nullGroup));
-        checkHandler(false, handler, grpOpt);
-    }
-
-    private static Stream<Arguments> createOptionValuesParameters() throws ParseException {
-        final List<Arguments> lst = new ArrayList<>();
-        final Option optT = Option.builder().option("T").longOpt("tee").numberOfArgs(2).deprecated().optionalArg(true).build();
-        final Option optU = Option.builder("U").longOpt("you").numberOfArgs(2).optionalArg(true).build();
-        final OptionGroup optionGroup = new OptionGroup().addOption(optT).addOption(optU);
-
-        final String[] foobar = { "foo", "bar" };
-        // T set
-        lst.add(Arguments.of(new String[] {"-T"}, optT, optionGroup, true, null, true, null, optT));
-        lst.add(Arguments.of(new String[] {"-T", "foo", "bar"}, optT, optionGroup, true, foobar, true, foobar, optT));
-        lst.add(Arguments.of(new String[] {"--tee"}, optT, optionGroup, true, null, true, null, optT));
-        lst.add(Arguments.of(new String[] {"--tee", "foo", "bar"}, optT, optionGroup, true, foobar, true, foobar, optT));
-
-        lst.add(Arguments.of(new String[] {"-U"}, optT, optionGroup, false, null, false, null, optU));
-        lst.add(Arguments.of(new String[] {"-U", "foo", "bar"}, optT, optionGroup, false, null, false, foobar, optU));
-        lst.add(Arguments.of(new String[] {"--you"}, optT, optionGroup, false, null, false, null, optU));
-        lst.add(Arguments.of(new String[] {"--you", "foo", "bar"}, optT, optionGroup, false, null, false, foobar, optU));
-
-
-        // U set
-        lst.add(Arguments.of(new String[] {"-T"}, optU, optionGroup, false, null, true, null, optT));
-        lst.add(Arguments.of(new String[] {"-T", "foo", "bar"}, optU, optionGroup, false, null, true, foobar, optT));
-        lst.add(Arguments.of(new String[] {"--tee"}, optU, optionGroup, false, null, true, null, optT));
-        lst.add(Arguments.of(new String[] {"--tee", "foo", "bar"}, optU, optionGroup, false, null, true, foobar, optT));
-
-        lst.add(Arguments.of(new String[] {"-U"}, optU, optionGroup, false, null, false, null, optU));
-        lst.add(Arguments.of(new String[] {"-U", "foo", "bar"}, optU, optionGroup, false, foobar, false, foobar, optU));
-        lst.add(Arguments.of(new String[] {"--you"}, optU, optionGroup, false, null, false, null, optU));
-        lst.add(Arguments.of(new String[] {"--you", "foo", "bar"},  optU, optionGroup, false, foobar, false, foobar, optU));
-
-        return lst.stream();
-    }
-
-    /**
-     * Tests the hasOption calls.
-     * @param args the argument strings to parse.
-     * @param opt the option to check for values with.
-     * @param optionGroup the option group to check for values with.
-     * @param optDep {@code true} if the opt is deprecated.
-     * @param has {@code true} if the opt is present.
-     * @param grpDep {@code true} if the group is deprecated.
-     * @param hasGrp {@code true} if the group is present.
-     * @param grpOpt the option that is expected to be processed by the group.
-     * @throws ParseException on parsing error.
-     */
     @ParameterizedTest(name = "{0}, {1}")
-    @MethodSource("createHasOptionParameters")
-    public void hasOptionTest(final String[] args, final Option opt, final OptionGroup optionGroup, final boolean optDep,
-                              final boolean has, final boolean grpDep, final boolean hasGrp, final Option grpOpt) throws ParseException {
+    @MethodSource("createParsedOptionValueParameters")
+    public void getParsedOptionValueTest(final String[] args, final Option opt, final OptionGroup optionGroup, final boolean optDep,
+                                         final Integer optValue, final boolean grpDep, final Integer grpValue, final Option grpOpt) throws ParseException {
         final Options options = new Options().addOptionGroup(optionGroup);
         final List<Option> handler = new ArrayList<>();
         final CommandLine commandLine = DefaultParser.builder().setDeprecatedHandler(handler::add).build().parse(options, args);
+        final Supplier<Integer> thinger = () -> 2;
         final OptionGroup otherGroup = new OptionGroup().addOption(Option.builder("o").longOpt("other").hasArg().build())
                 .addOption(Option.builder().option("p").longOpt("part").hasArg().build());
         final OptionGroup nullGroup = null;
+        final Integer thing = 2;
 
         // test char option arg
-        assertEquals(has, commandLine.hasOption(asChar(opt)));
+        assertEquals(optValue, commandLine.getParsedOptionValue(asChar(opt)));
+        checkHandler(optDep, handler, opt);
+
+        assertEquals(optValue == null ? thing : optValue, commandLine.getParsedOptionValue(asChar(opt), thing));
+        checkHandler(optDep, handler, opt);
+
+        assertEquals(optValue == null ? thing : optValue, commandLine.getParsedOptionValue(asChar(opt), thinger));
         checkHandler(optDep, handler, opt);
 
         // test short option arg
-        assertEquals(has, commandLine.hasOption(opt.getOpt()));
+        assertEquals(optValue, commandLine.getParsedOptionValue(opt.getOpt()));
+        checkHandler(optDep, handler, opt);
+
+        assertEquals(optValue == null ? thing : optValue, commandLine.getParsedOptionValue(opt.getOpt(), thing));
+        checkHandler(optDep, handler, opt);
+
+        assertEquals(optValue == null ? thing : optValue, commandLine.getParsedOptionValue(opt.getOpt(), thinger));
         checkHandler(optDep, handler, opt);
 
         // test long option arg
-        assertEquals(has, commandLine.hasOption(opt.getLongOpt()));
+        assertEquals(optValue, commandLine.getParsedOptionValue(opt.getLongOpt()));
+        checkHandler(optDep, handler, opt);
+
+        assertEquals(optValue == null ? thing : optValue, commandLine.getParsedOptionValue(opt.getLongOpt(), thing));
+        checkHandler(optDep, handler, opt);
+
+        assertEquals(optValue == null ? thing : optValue, commandLine.getParsedOptionValue(opt.getLongOpt(), thinger));
         checkHandler(optDep, handler, opt);
 
+
         // test Option arg
-        assertEquals(has, commandLine.hasOption(opt));
+        assertEquals(optValue, commandLine.getParsedOptionValue(opt));
+        checkHandler(optDep, handler, opt);
+
+        assertEquals(optValue == null ? thing : optValue, commandLine.getParsedOptionValue(opt, thing));
+        checkHandler(optDep, handler, opt);
+
+        assertEquals(optValue == null ? thing : optValue, commandLine.getParsedOptionValue(opt, thinger));
         checkHandler(optDep, handler, opt);
 
         // test OptionGroup arg
-        assertEquals(hasGrp, commandLine.hasOption(optionGroup));
+        assertEquals(grpValue, commandLine.getParsedOptionValue(optionGroup));
         checkHandler(grpDep, handler, grpOpt);
 
-        // test other group arg
-        assertFalse(commandLine.hasOption(otherGroup));
+        assertEquals(grpValue == null ? thing : grpValue, commandLine.getParsedOptionValue(optionGroup, thing));
+        checkHandler(grpDep, handler, grpOpt);
+
+        assertEquals(grpValue == null ? thing : grpValue, commandLine.getParsedOptionValue(optionGroup, thinger));
+        checkHandler(grpDep, handler, grpOpt);
+
+        // test other Group arg
+        assertNull(commandLine.getParsedOptionValue(otherGroup));
+        checkHandler(false, handler, grpOpt);
+
+        assertEquals(thing, commandLine.getParsedOptionValue(otherGroup, thing));
         checkHandler(false, handler, grpOpt);
 
+        assertEquals(thing, commandLine.getParsedOptionValue(otherGroup, thinger));
+        checkHandler(false, handler, grpOpt);
 
-        // test null group arg
-        assertFalse(commandLine.hasOption(nullGroup));
+        // test null Group arg
+        assertNull(commandLine.getParsedOptionValue(nullGroup));
+        checkHandler(false, handler, grpOpt);
+
+        assertEquals(thing, commandLine.getParsedOptionValue(nullGroup, thing));
+        checkHandler(false, handler, grpOpt);
+
+        assertEquals(thing, commandLine.getParsedOptionValue(nullGroup, thinger));
         checkHandler(false, handler, grpOpt);
 
+
         // test not an option
-        assertFalse(commandLine.hasOption("Nope"));
+        assertNull(commandLine.getParsedOptionValue("Nope"));
+        checkHandler(false, handler, opt);
+
+        assertEquals(thing, commandLine.getParsedOptionValue("Nope", thing));
+        checkHandler(false, handler, opt);
+
+        assertEquals(thing, commandLine.getParsedOptionValue("Nope", thinger));
         checkHandler(false, handler, opt);
     }
 
@@ -704,189 +542,351 @@ public class CommandLineTest {
             assertWritten(false, baos);
 
 
-            // test short option arg
-            assertEquals(has, commandLine.hasOption(opt.getOpt()));
+            // test short option arg
+            assertEquals(has, commandLine.hasOption(opt.getOpt()));
+            assertWritten(false, baos);
+
+            // test long option arg
+            assertEquals(has, commandLine.hasOption(opt.getLongOpt()));
+            assertWritten(false, baos);
+
+            // test Option arg
+            assertEquals(has, commandLine.hasOption(opt));
+            assertWritten(false, baos);
+
+            // test OptionGroup arg
+            assertEquals(hasGrp, commandLine.hasOption(optionGroup));
+            assertWritten(false, baos);
+
+            // test not an option
+            assertFalse(commandLine.hasOption("Nope"));
+            assertWritten(false, baos);
+        } finally {
+            System.setOut(ps);
+        }
+    }
+
+    /**
+     * Tests the hasOption calls.
+     * @param args the argument strings to parse.
+     * @param opt the option to check for values with.
+     * @param optionGroup the option group to check for values with.
+     * @param optDep {@code true} if the opt is deprecated.
+     * @param has {@code true} if the opt is present.
+     * @param grpDep {@code true} if the group is deprecated.
+     * @param hasGrp {@code true} if the group is present.
+     * @param grpOpt the option that is expected to be processed by the group.
+     * @throws ParseException on parsing error.
+     */
+    @ParameterizedTest(name = "{0}, {1}")
+    @MethodSource("createHasOptionParameters")
+    public void hasOptionTest(final String[] args, final Option opt, final OptionGroup optionGroup, final boolean optDep,
+                              final boolean has, final boolean grpDep, final boolean hasGrp, final Option grpOpt) throws ParseException {
+        final Options options = new Options().addOptionGroup(optionGroup);
+        final List<Option> handler = new ArrayList<>();
+        final CommandLine commandLine = DefaultParser.builder().setDeprecatedHandler(handler::add).build().parse(options, args);
+        final OptionGroup otherGroup = new OptionGroup().addOption(Option.builder("o").longOpt("other").hasArg().build())
+                .addOption(Option.builder().option("p").longOpt("part").hasArg().build());
+        final OptionGroup nullGroup = null;
+
+        // test char option arg
+        assertEquals(has, commandLine.hasOption(asChar(opt)));
+        checkHandler(optDep, handler, opt);
+
+        // test short option arg
+        assertEquals(has, commandLine.hasOption(opt.getOpt()));
+        checkHandler(optDep, handler, opt);
+
+        // test long option arg
+        assertEquals(has, commandLine.hasOption(opt.getLongOpt()));
+        checkHandler(optDep, handler, opt);
+
+        // test Option arg
+        assertEquals(has, commandLine.hasOption(opt));
+        checkHandler(optDep, handler, opt);
+
+        // test OptionGroup arg
+        assertEquals(hasGrp, commandLine.hasOption(optionGroup));
+        checkHandler(grpDep, handler, grpOpt);
+
+        // test other group arg
+        assertFalse(commandLine.hasOption(otherGroup));
+        checkHandler(false, handler, grpOpt);
+
+
+        // test null group arg
+        assertFalse(commandLine.hasOption(nullGroup));
+        checkHandler(false, handler, grpOpt);
+
+        // test not an option
+        assertFalse(commandLine.hasOption("Nope"));
+        checkHandler(false, handler, opt);
+    }
+
+    @ParameterizedTest(name = "{0}, {1}")
+    @MethodSource("createOptionValueParameters")
+    public void noDeprecationHandlerTest(final String[] args, final Option opt, final OptionGroup optionGroup, final boolean optDep,
+                                   final String optValue, final boolean grpDep, final String grpValue, final Option grpOpt) throws ParseException {
+        final Options options = new Options().addOptionGroup(optionGroup);
+        final CommandLine commandLine = DefaultParser.builder().build().parse(options, args);
+        final Supplier<String> thinger = () -> "thing";
+        final Supplier<String> nullSupplier = null;
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final PrintStream ps = System.out;
+        try {
+            System.setOut(new PrintStream(baos));
+
+            final OptionGroup otherGroup = new OptionGroup().addOption(Option.builder("o").longOpt("other").hasArg().build())
+                    .addOption(Option.builder().option("p").longOpt("part").hasArg().build());
+            final OptionGroup nullGroup = null;
+
+            // test char option
+            assertEquals(optValue, commandLine.getOptionValue(asChar(opt)));
+            assertWritten(optDep, baos);
+
+            assertEquals(optValue == null ? "thing" : optValue, commandLine.getOptionValue(asChar(opt), "thing"));
+            assertWritten(optDep, baos);
+
+            assertEquals(optValue == null ? "thing" : optValue, commandLine.getOptionValue(asChar(opt), thinger));
+            assertWritten(optDep, baos);
+
+            assertEquals(optValue, commandLine.getOptionValue(asChar(opt), nullSupplier));
+            assertWritten(optDep, baos);
+
+            // test short option arg
+            assertEquals(optValue, commandLine.getOptionValue(opt.getOpt()));
+            assertWritten(optDep, baos);
+
+            assertEquals(optValue == null ? "thing" : optValue, commandLine.getOptionValue(opt.getOpt(), "thing"));
+            assertWritten(optDep, baos);
+
+            assertEquals(optValue == null ? "thing" : optValue, commandLine.getOptionValue(opt.getOpt(), thinger));
+            assertWritten(optDep, baos);
+
+            assertEquals(optValue, commandLine.getOptionValue(opt.getOpt(), nullSupplier));
+            assertWritten(optDep, baos);
+
+            // test long option arg
+            assertEquals(optValue, commandLine.getOptionValue(opt.getLongOpt()));
+            assertWritten(optDep, baos);
+
+            assertEquals(optValue == null ? "thing" : optValue, commandLine.getOptionValue(opt.getLongOpt(), "thing"));
+            assertWritten(optDep, baos);
+
+            assertEquals(optValue == null ? "thing" : optValue, commandLine.getOptionValue(opt.getLongOpt(), thinger));
+            assertWritten(optDep, baos);
+
+            assertEquals(optValue, commandLine.getOptionValue(opt.getLongOpt(), nullSupplier));
+            assertWritten(optDep, baos);
+
+            // test Option arg
+            assertEquals(optValue, commandLine.getOptionValue(opt));
+            assertWritten(optDep, baos);
+
+            assertEquals(optValue == null ? "thing" : optValue, commandLine.getOptionValue(opt, "thing"));
+            assertWritten(optDep, baos);
+
+            assertEquals(optValue == null ? "thing" : optValue, commandLine.getOptionValue(opt, thinger));
+            assertWritten(optDep, baos);
+
+            assertEquals(optValue, commandLine.getOptionValue(opt, nullSupplier));
+            assertWritten(optDep, baos);
+
+            // test optionGroup  arg
+            assertEquals(grpValue, commandLine.getOptionValue(optionGroup));
+            assertWritten(grpDep, baos);
+
+            assertEquals(grpValue == null ? "thing" : grpValue, commandLine.getOptionValue(optionGroup, "thing"));
+            assertWritten(grpDep, baos);
+
+            assertEquals(grpValue == null ? "thing" : grpValue, commandLine.getOptionValue(optionGroup, thinger));
+            assertWritten(grpDep, baos);
+
+            assertEquals(grpValue, commandLine.getOptionValue(optionGroup, nullSupplier));
+            assertWritten(grpDep, baos);
+
+            // test other group arg
+            assertNull(commandLine.getOptionValue(otherGroup));
+            assertWritten(false, baos);
+
+            assertEquals("thing", commandLine.getOptionValue(otherGroup, "thing"));
+            assertWritten(false, baos);
+
+            assertEquals("thing", commandLine.getOptionValue(otherGroup, thinger));
+            assertWritten(false, baos);
+
+            assertNull(commandLine.getOptionValue(otherGroup, nullSupplier));
+            assertWritten(false, baos);
+
+            // test null Group arg
+            assertNull(commandLine.getOptionValue(nullGroup));
+            assertWritten(false, baos);
+
+            assertEquals("thing", commandLine.getOptionValue(nullGroup, "thing"));
+            assertWritten(false, baos);
+
+            assertEquals("thing", commandLine.getOptionValue(nullGroup, thinger));
+            assertWritten(false, baos);
+
+            assertNull(commandLine.getOptionValue(nullGroup, nullSupplier));
             assertWritten(false, baos);
 
-            // test long option arg
-            assertEquals(has, commandLine.hasOption(opt.getLongOpt()));
+            // test not an option
+            assertNull(commandLine.getOptionValue("Nope"));
             assertWritten(false, baos);
 
-            // test Option arg
-            assertEquals(has, commandLine.hasOption(opt));
+            assertEquals("thing", commandLine.getOptionValue("Nope", "thing"));
             assertWritten(false, baos);
 
-            // test OptionGroup arg
-            assertEquals(hasGrp, commandLine.hasOption(optionGroup));
+            assertEquals("thing", commandLine.getOptionValue("Nope", thinger));
             assertWritten(false, baos);
 
-            // test not an option
-            assertFalse(commandLine.hasOption("Nope"));
+            assertNull(commandLine.getOptionValue("Nope", nullSupplier));
             assertWritten(false, baos);
         } finally {
             System.setOut(ps);
         }
     }
 
-    private static Stream<Arguments> createHasOptionParameters() throws ParseException {
-        final List<Arguments> lst = new ArrayList<>();
-        final Option optT = Option.builder().option("T").longOpt("tee").deprecated().optionalArg(true).build();
-        final Option optU = Option.builder("U").longOpt("you").optionalArg(true).build();
-        final OptionGroup optionGroup = new OptionGroup().addOption(optT).addOption(optU);
-
-        final String[] foobar = { "foo", "bar" };
-        // T set
-        lst.add(Arguments.of(new String[] {"-T"}, optT, optionGroup, true, true, true, true, optT));
-        lst.add(Arguments.of(new String[] {"-T", "foo"}, optT, optionGroup, true, true, true, true, optT));
-        lst.add(Arguments.of(new String[] {"--tee"}, optT, optionGroup, true, true, true, true, optT));
-        lst.add(Arguments.of(new String[] {"--tee", "foo"}, optT, optionGroup, true, true, true, true, optT));
-
-        lst.add(Arguments.of(new String[] {"-U"}, optT, optionGroup, false, false, false, true, optU));
-        lst.add(Arguments.of(new String[] {"-U", "foo", "bar"}, optT, optionGroup, false, false, false, true, optU));
-        lst.add(Arguments.of(new String[] {"--you"}, optT, optionGroup, false, false, false, true, optU));
-        lst.add(Arguments.of(new String[] {"--you", "foo", "bar"}, optT, optionGroup, false, false, false, true, optU));
+    @Test
+    public void testBadGetParsedOptionValue() throws Exception {
 
+        final Options options = new Options();
+        options.addOption(Option.builder("i").hasArg().type(Number.class).build());
+        options.addOption(Option.builder("c").hasArg().converter(s -> Count.valueOf(s.toUpperCase())).build());
 
-        // U set
-        lst.add(Arguments.of(new String[] {"-T"}, optU, optionGroup, false, false, true, true, optT));
-        lst.add(Arguments.of(new String[] {"-T", "foo", "bar"}, optU, optionGroup, false, false, true, true, optT));
-        lst.add(Arguments.of(new String[] {"--tee"}, optU, optionGroup, false, false, true, true, optT));
-        lst.add(Arguments.of(new String[] {"--tee", "foo", "bar"}, optU, optionGroup, false, false, true, true, optT));
 
-        lst.add(Arguments.of(new String[] {"-U"}, optU, optionGroup, false, true, false, true, optU));
-        lst.add(Arguments.of(new String[] {"-U", "foo", "bar"}, optU, optionGroup, false, true, false, true, optU));
-        lst.add(Arguments.of(new String[] {"--you"}, optU, optionGroup, false, true, false, true, optU));
-        lst.add(Arguments.of(new String[] {"--you", "foo", "bar"},  optU, optionGroup, false, true, false, true, optU));
+        final CommandLineParser parser = new DefaultParser();
+        final CommandLine cmd = parser.parse(options, new String[] {"-i", "foo", "-c", "bar"});
 
-        return lst.stream();
+        assertEquals(NumberFormatException.class, assertThrows(ParseException.class, () -> cmd.getParsedOptionValue("i")).getCause().getClass());
+        assertEquals(IllegalArgumentException.class, assertThrows(ParseException.class, () -> cmd.getParsedOptionValue("c")).getCause().getClass());
     }
 
-    @ParameterizedTest(name = "{0}, {1}")
-    @MethodSource("createParsedOptionValueParameters")
-    public void getParsedOptionValueTest(final String[] args, final Option opt, final OptionGroup optionGroup, final boolean optDep,
-                                         final Integer optValue, final boolean grpDep, final Integer grpValue, final Option grpOpt) throws ParseException {
-        final Options options = new Options().addOptionGroup(optionGroup);
-        final List<Option> handler = new ArrayList<>();
-        final CommandLine commandLine = DefaultParser.builder().setDeprecatedHandler(handler::add).build().parse(options, args);
-        final Supplier<Integer> thinger = () -> 2;
-        final OptionGroup otherGroup = new OptionGroup().addOption(Option.builder("o").longOpt("other").hasArg().build())
-                .addOption(Option.builder().option("p").longOpt("part").hasArg().build());
-        final OptionGroup nullGroup = null;
-        final Integer thing = 2;
-
-        // test char option arg
-        assertEquals(optValue, commandLine.getParsedOptionValue(asChar(opt)));
-        checkHandler(optDep, handler, opt);
-
-        assertEquals(optValue == null ? thing : optValue, commandLine.getParsedOptionValue(asChar(opt), thing));
-        checkHandler(optDep, handler, opt);
-
-        assertEquals(optValue == null ? thing : optValue, commandLine.getParsedOptionValue(asChar(opt), thinger));
-        checkHandler(optDep, handler, opt);
-
-        // test short option arg
-        assertEquals(optValue, commandLine.getParsedOptionValue(opt.getOpt()));
-        checkHandler(optDep, handler, opt);
-
-        assertEquals(optValue == null ? thing : optValue, commandLine.getParsedOptionValue(opt.getOpt(), thing));
-        checkHandler(optDep, handler, opt);
-
-        assertEquals(optValue == null ? thing : optValue, commandLine.getParsedOptionValue(opt.getOpt(), thinger));
-        checkHandler(optDep, handler, opt);
-
-        // test long option arg
-        assertEquals(optValue, commandLine.getParsedOptionValue(opt.getLongOpt()));
-        checkHandler(optDep, handler, opt);
-
-        assertEquals(optValue == null ? thing : optValue, commandLine.getParsedOptionValue(opt.getLongOpt(), thing));
-        checkHandler(optDep, handler, opt);
-
-        assertEquals(optValue == null ? thing : optValue, commandLine.getParsedOptionValue(opt.getLongOpt(), thinger));
-        checkHandler(optDep, handler, opt);
 
+    @Test
+    public void testBuilder() {
+        final CommandLine.Builder builder = new CommandLine.Builder();
+        builder.addArg("foo").addArg("bar");
+        builder.addOption(Option.builder("T").build());
+        final CommandLine cmd = builder.build();
 
-        // test Option arg
-        assertEquals(optValue, commandLine.getParsedOptionValue(opt));
-        checkHandler(optDep, handler, opt);
-
-        assertEquals(optValue == null ? thing : optValue, commandLine.getParsedOptionValue(opt, thing));
-        checkHandler(optDep, handler, opt);
+        assertEquals("foo", cmd.getArgs()[0]);
+        assertEquals("bar", cmd.getArgList().get(1));
+        assertEquals("T", cmd.getOptions()[0].getOpt());
+    }
 
-        assertEquals(optValue == null ? thing : optValue, commandLine.getParsedOptionValue(opt, thinger));
-        checkHandler(optDep, handler, opt);
+    @Test
+    public void testBuilderNullArgs() {
+        final CommandLine.Builder builder = new CommandLine.Builder();
+        builder.addArg(null).addArg(null);
+        builder.addOption(Option.builder("T").build());
+        final CommandLine cmd = builder.build();
 
-        // test OptionGroup arg
-        assertEquals(grpValue, commandLine.getParsedOptionValue(optionGroup));
-        checkHandler(grpDep, handler, grpOpt);
+        assertEquals(0, cmd.getArgs().length);
+        assertEquals("T", cmd.getOptions()[0].getOpt());
+    }
 
-        assertEquals(grpValue == null ? thing : grpValue, commandLine.getParsedOptionValue(optionGroup, thing));
-        checkHandler(grpDep, handler, grpOpt);
+    @Test
+    public void testBuilderNullOption() {
+        final CommandLine.Builder builder = new CommandLine.Builder();
+        builder.addArg("foo").addArg("bar");
+        builder.addOption(null);
+        builder.addOption(null);
+        builder.addOption(null);
+        final CommandLine cmd = builder.build();
 
-        assertEquals(grpValue == null ? thing : grpValue, commandLine.getParsedOptionValue(optionGroup, thinger));
-        checkHandler(grpDep, handler, grpOpt);
+        assertEquals("foo", cmd.getArgs()[0]);
+        assertEquals("bar", cmd.getArgList().get(1));
+        assertEquals(0, cmd.getOptions().length);
+    }
 
-        // test other Group arg
-        assertNull(commandLine.getParsedOptionValue(otherGroup));
-        checkHandler(false, handler, grpOpt);
+    @Test
+    public void testGetOptionProperties() throws Exception {
+        final String[] args = {"-Dparam1=value1", "-Dparam2=value2", "-Dparam3", "-Dparam4=value4", "-D", "--property", "foo=bar"};
 
-        assertEquals(thing, commandLine.getParsedOptionValue(otherGroup, thing));
-        checkHandler(false, handler, grpOpt);
+        final Options options = new Options();
+        options.addOption(Option.builder("D").valueSeparator().optionalArg(true).numberOfArgs(2).build());
+        options.addOption(Option.builder().valueSeparator().numberOfArgs(2).longOpt("property").build());
 
-        assertEquals(thing, commandLine.getParsedOptionValue(otherGroup, thinger));
-        checkHandler(false, handler, grpOpt);
+        final Parser parser = new GnuParser();
+        final CommandLine cl = parser.parse(options, args);
 
-        // test null Group arg
-        assertNull(commandLine.getParsedOptionValue(nullGroup));
-        checkHandler(false, handler, grpOpt);
+        final Properties props = cl.getOptionProperties("D");
+        assertNotNull(props, "null properties");
+        assertEquals(4, props.size(), "number of properties in " + props);
+        assertEquals("value1", props.getProperty("param1"), "property 1");
+        assertEquals("value2", props.getProperty("param2"), "property 2");
+        assertEquals("true", props.getProperty("param3"), "property 3");
+        assertEquals("value4", props.getProperty("param4"), "property 4");
 
-        assertEquals(thing, commandLine.getParsedOptionValue(nullGroup, thing));
-        checkHandler(false, handler, grpOpt);
+        assertEquals("bar", cl.getOptionProperties("property").getProperty("foo"), "property with long format");
+    }
 
-        assertEquals(thing, commandLine.getParsedOptionValue(nullGroup, thinger));
-        checkHandler(false, handler, grpOpt);
+    @Test
+    public void testGetOptionPropertiesWithOption() throws Exception {
+        final String[] args = {"-Dparam1=value1", "-Dparam2=value2", "-Dparam3", "-Dparam4=value4", "-D", "--property", "foo=bar"};
 
+        final Options options = new Options();
+        final Option optionD = Option.builder("D").valueSeparator().numberOfArgs(2).optionalArg(true).build();
+        final Option optionProperty = Option.builder().valueSeparator().numberOfArgs(2).longOpt("property").build();
+        options.addOption(optionD);
+        options.addOption(optionProperty);
 
-        // test not an option
-        assertNull(commandLine.getParsedOptionValue("Nope"));
-        checkHandler(false, handler, opt);
+        final Parser parser = new GnuParser();
+        final CommandLine cl = parser.parse(options, args);
 
-        assertEquals(thing, commandLine.getParsedOptionValue("Nope", thing));
-        checkHandler(false, handler, opt);
+        final Properties props = cl.getOptionProperties(optionD);
+        assertNotNull(props, "null properties");
+        assertEquals(4, props.size(), "number of properties in " + props);
+        assertEquals("value1", props.getProperty("param1"), "property 1");
+        assertEquals("value2", props.getProperty("param2"), "property 2");
+        assertEquals("true", props.getProperty("param3"), "property 3");
+        assertEquals("value4", props.getProperty("param4"), "property 4");
 
-        assertEquals(thing, commandLine.getParsedOptionValue("Nope", thinger));
-        checkHandler(false, handler, opt);
+        assertEquals("bar", cl.getOptionProperties(optionProperty).getProperty("foo"), "property with long format");
     }
 
-    private static Stream<Arguments> createParsedOptionValueParameters() throws ParseException {
-        final List<Arguments> lst = new ArrayList<>();
-        final Option optT = Option.builder().option("T").longOpt("tee").deprecated().type(Integer.class).optionalArg(true).build();
-        final Option optU = Option.builder("U").longOpt("you").type(Integer.class).optionalArg(true).build();
-        final OptionGroup optionGroup = new OptionGroup().addOption(optT).addOption(optU);
-        final Integer expected = Integer.valueOf(1);
+    @Test
+    public void testGetOptionsBuilder() {
+        final CommandLine cmd = CommandLine.builder().build();
+        assertNotNull(cmd.getOptions());
+        assertEquals(0, cmd.getOptions().length);
 
-        // T set
-        lst.add(Arguments.of(new String[] {"-T"}, optT, optionGroup, true, null, true, null, optT));
-        lst.add(Arguments.of(new String[] {"-T", "1"}, optT, optionGroup, true, expected, true, expected, optT));
-        lst.add(Arguments.of(new String[] {"--tee"}, optT, optionGroup, true, null, true, null, optT));
-        lst.add(Arguments.of(new String[] {"--tee", "1"}, optT, optionGroup, true, expected, true, expected, optT));
+        cmd.addOption(null);
+        cmd.addOption(new Option("a", null));
+        cmd.addOption(new Option("b", null));
+        cmd.addOption(new Option("c", null));
 
-        lst.add(Arguments.of(new String[] {"-U"}, optT, optionGroup, false, null, false, null, optU));
-        lst.add(Arguments.of(new String[] {"-U", "1"}, optT, optionGroup, false, null, false, expected, optU));
-        lst.add(Arguments.of(new String[] {"--you"}, optT, optionGroup, false, null, false, null, optU));
-        lst.add(Arguments.of(new String[] {"--you", "1"}, optT, optionGroup, false, null, false, expected, optU));
+        assertEquals(3, cmd.getOptions().length);
+    }
 
+    @Test
+    public void testGetOptionsCtor() {
+        final CommandLine cmd = new CommandLine();
+        assertNotNull(cmd.getOptions());
+        assertEquals(0, cmd.getOptions().length);
 
-        // U set
-        lst.add(Arguments.of(new String[] {"-T"}, optU, optionGroup, false, null, true, null, optT));
-        lst.add(Arguments.of(new String[] {"-T", "1"}, optU, optionGroup, false, null, true, expected, optT));
-        lst.add(Arguments.of(new String[] {"--tee"}, optU, optionGroup, false, null, true, null, optT));
-        lst.add(Arguments.of(new String[] {"--tee", "1"}, optU, optionGroup, false, null, true, expected, optT));
+        cmd.addOption(new Option("a", null));
+        cmd.addOption(new Option("b", null));
+        cmd.addOption(new Option("c", null));
+        cmd.addOption(null);
 
-        lst.add(Arguments.of(new String[] {"-U"}, optU, optionGroup, false, null, false, null, optU));
-        lst.add(Arguments.of(new String[] {"-U", "1"}, optU, optionGroup, false, expected, false, expected, optU));
-        lst.add(Arguments.of(new String[] {"--you"}, optU, optionGroup, false, null, false, null, optU));
-        lst.add(Arguments.of(new String[] {"--you", "1"},  optU, optionGroup, false, expected, false, expected, optU));
+        assertEquals(3, cmd.getOptions().length);
+    }
 
-        return lst.stream();
+    @Test
+    public void testNullOption() 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", "-f", "foo"});
+        assertNull(cmd.getOptionValue((Option) null));
+        assertNull(cmd.getParsedOptionValue((Option) null));
+        assertNull(cmd.getOptionValue((OptionGroup) null));
+        assertNull(cmd.getParsedOptionValue((OptionGroup) null));
     }
 }


(commons-cli) 01/09: Better param name

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-cli.git

commit a78cff6747c0948e889fec13045587f922c64321
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Aug 10 08:44:58 2024 -0400

    Better param name
---
 src/main/java/org/apache/commons/cli/Option.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/commons/cli/Option.java b/src/main/java/org/apache/commons/cli/Option.java
index 25e5ac4..170d884 100644
--- a/src/main/java/org/apache/commons/cli/Option.java
+++ b/src/main/java/org/apache/commons/cli/Option.java
@@ -218,11 +218,11 @@ public class Option implements Cloneable, Serializable {
         /**
          * Sets the long name of the Option.
          *
-         * @param longOpt the long name of the Option
+         * @param longOption the long name of the Option
          * @return this builder.
          */
-        public Builder longOpt(final String longOpt) {
-            this.longOption = longOpt;
+        public Builder longOpt(final String longOption) {
+            this.longOption = longOption;
             return this;
         }
 


(commons-cli) 09/09: Prepare for the next release candidate

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-cli.git

commit 595c54bd747c2f80447e0b4475c063f2e7ee7a7c
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Aug 10 13:00:41 2024 +0000

    Prepare for the next release candidate
---
 CONTRIBUTING.md                |  9 ++++-----
 README.md                      | 12 +++++++-----
 RELEASE-NOTES.txt              | 42 ++++++++++++++++++++++++++++++++++++++++++
 src/changes/changes.xml        |  2 +-
 src/site/xdoc/download_cli.xml | 26 +++++++++++++-------------
 5 files changed, 67 insertions(+), 24 deletions(-)

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index a3ab78c..1282796 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -41,9 +41,8 @@
 Contributing to Apache Commons CLI
 ======================
 
-You have found a bug or you have an idea for a cool new feature? Contributing code is a great way to give something back to
-the open source community. Before you dig right into the code there are a few guidelines that we need contributors to
-follow so that we can have a chance of keeping on top of things.
+Have you found a bug or have an idea for a cool new feature? Contributing code is a great way to give something back to the open-source community.
+Before you dig right into the code, we need contributors to follow a few guidelines to have a chance of keeping on top of things.
 
 Getting Started
 ---------------
@@ -62,7 +61,7 @@ Making Changes
 
 + Create a _topic branch_ for your isolated work.
   * Usually you should base your branch on the `master` branch.
-  * A good topic branch name can be the JIRA bug id plus a keyword, e.g. `CLI-123-InputStream`.
+  * A good topic branch name can be the JIRA bug ID plus a keyword, e.g. `CLI-123-InputStream`.
   * If you have submitted multiple JIRA issues, try to maintain separate branches and pull requests.
 + Make commits of logical units.
   * Make sure your commit messages are meaningful and in the proper format. Your commit message should contain the key of the JIRA issue.
@@ -72,7 +71,7 @@ Making Changes
   + Create minimal diffs - disable _On Save_ actions like _Reformat Source Code_ or _Organize Imports_. If you feel the source code should be reformatted create a separate PR for this change first.
   + Check for unnecessary whitespace with `git diff` -- check before committing.
 + Make sure you have added the necessary tests for your changes, typically in `src/test/java`.
-+ Run all the tests with `mvn clean verify` to assure nothing else was accidentally broken.
++ Run all the tests with `mvn clean verify` to ensure nothing else was accidentally broken.
 
 Making Trivial Changes
 ----------------------
diff --git a/README.md b/README.md
index 925fb7b..66ed382 100644
--- a/README.md
+++ b/README.md
@@ -45,7 +45,7 @@ Apache Commons CLI
 
 [![Java CI](https://github.com/apache/commons-cli/actions/workflows/maven.yml/badge.svg)](https://github.com/apache/commons-cli/actions/workflows/maven.yml)
 [![Maven Central](https://maven-badges.herokuapp.com/maven-central/commons-cli/commons-cli/badge.svg?gav=true)](https://maven-badges.herokuapp.com/maven-central/commons-cli/commons-cli/?gav=true)
-[![Javadocs](https://javadoc.io/badge/commons-cli/commons-cli/1.8.0.svg)](https://javadoc.io/doc/commons-cli/commons-cli/1.8.0)
+[![Javadocs](https://javadoc.io/badge/commons-cli/commons-cli/1.9.0.svg)](https://javadoc.io/doc/commons-cli/commons-cli/1.9.0)
 [![CodeQL](https://github.com/apache/commons-cli/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/apache/commons-cli/actions/workflows/codeql-analysis.yml)
 [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/apache/commons-cli/badge)](https://api.securityscorecards.dev/projects/github.com/apache/commons-cli)
 
@@ -62,20 +62,20 @@ Getting the latest release
 --------------------------
 You can download source and binaries from our [download page](https://commons.apache.org/proper/commons-cli/download_cli.cgi).
 
-Alternatively, you can pull it from  the central Maven repositories:
+Alternatively, you can pull it from the central Maven repositories:
 
 ```xml
 <dependency>
   <groupId>commons-cli</groupId>
   <artifactId>commons-cli</artifactId>
-  <version>1.8.0</version>
+  <version>1.9.0</version>
 </dependency>
 ```
 
 Building
 --------
 
-Building requires a Java JDK and [Apache Maven](https://maven.apache.org/). 
+Building requires a Java JDK and [Apache Maven](https://maven.apache.org/).
 The required Java version is found in the `pom.xml` as the `maven.compiler.source` property.
 
 From a command shell, run `mvn` without arguments to invoke the default Maven goal to run all tests and checks.
@@ -88,7 +88,9 @@ There are some guidelines which will make applying PRs easier for us:
 + No tabs! Please use spaces for indentation.
 + Respect the existing code style for each file.
 + Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change.
-+ Provide JUnit tests for your changes and make sure your changes don't break any existing tests by running ```mvn```.
++ Provide JUnit tests for your changes and make sure your changes don't break any existing tests by running `mvn`.
++ Before you pushing a PR, run `mvn` (by itself), this runs the default goal, which contains all build checks.
++ To see the code coverage report, regardless of coverage failures, run `mvn clean site -Dcommons.jacoco.haltOnFailure=false`
 
 If you plan to contribute on a regular basis, please consider filing a [contributor license agreement](https://www.apache.org/licenses/#clas).
 You can learn more about contributing via GitHub in our [contribution guidelines](CONTRIBUTING.md).
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index df3f445..1f6dd18 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -1,3 +1,45 @@
+Apache Commons CLI Version 1.9.0 Release Notes
+
+Apache Commons CLI provides a simple API for presenting, processing, and validating a Command Line Interface.
+
+This release contains new features and bug fixes and requires Java 8 or above.
+
+
+New Features
+------------
+
+*           Add OptionGroup.isSelected(). Thanks to Gary Gregory.
+*           You can now extend HelpFormatter.Builder. Thanks to Gary Gregory.
+*           Add 'since' attribute to Option to track when an Option was introduced #292 Thanks to Claude Warren.
+
+Fixed Bugs
+----------
+
+* CLI-334:  Fix Javadoc pathing #280. Thanks to Eric Pugh.
+* CLI-335:  Updated properties documentation #285. Thanks to Claude Warren.
+* CLI-336:  Deprecation not always reported #284. Thanks to Claude Warren, Gary Gregory.
+*           Replace internal StringBuffer with StringBuilder. Thanks to Gary Gregory.
+
+Updates
+-------
+
+*           Bump org.apache.commons:commons-parent from 70 to 72 #283. Thanks to Gary Gregory, Dependabot.
+
+
+Historical list of changes: https://commons.apache.org/proper/commons-cli/changes-report.html
+
+For complete information on Apache Commons CLI, including instructions on how to submit bug reports,
+patches, or suggestions for improvement, see the Apache Commons CLI website:
+
+https://commons.apache.org/proper/commons-cli/
+
+Download page: https://commons.apache.org/proper/commons-cli/download_cli.cgi
+
+Have fun!
+The Apache Commons Team
+
+------------------------------------------------------------------------------
+
 Apache Commons CLI Version 1.8.0 Release Notes
 
 Apache Commons CLI provides a simple API for presenting, processing, and validating a Command Line Interface.
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 87097df..d66ec18 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -22,7 +22,7 @@
     <title>Apache Commons CLI Release Notes</title>
   </properties>
   <body>
-    <release version="1.9.0" date="YYYY-MM-DD" description="This release contains new features and bug fixes and requires Java 8 or above.">
+    <release version="1.9.0" date="2024-08-10" description="This release contains new features and bug fixes and requires Java 8 or above.">
       <!-- ADD -->
       <action type="add" dev="ggregory" due-to="Gary Gregory">Add OptionGroup.isSelected().</action>
       <action type="add" dev="ggregory" due-to="Gary Gregory">You can now extend HelpFormatter.Builder.</action>
diff --git a/src/site/xdoc/download_cli.xml b/src/site/xdoc/download_cli.xml
index 71ab343..6deebf8 100644
--- a/src/site/xdoc/download_cli.xml
+++ b/src/site/xdoc/download_cli.xml
@@ -113,32 +113,32 @@ limitations under the License.
       </p>
     </subsection>
     </section>
-    <section name="Apache Commons CLI 1.8.0 ">
+    <section name="Apache Commons CLI 1.9.0 ">
       <subsection name="Binaries">
         <table>
           <tr>
-              <td><a href="[preferred]/commons/cli/binaries/commons-cli-1.8.0-bin.tar.gz">commons-cli-1.8.0-bin.tar.gz</a></td>
-              <td><a href="https://downloads.apache.org/commons/cli/binaries/commons-cli-1.8.0-bin.tar.gz.sha512">sha512</a></td>
-              <td><a href="https://downloads.apache.org/commons/cli/binaries/commons-cli-1.8.0-bin.tar.gz.asc">pgp</a></td>
+              <td><a href="[preferred]/commons/cli/binaries/commons-cli-1.9.0-bin.tar.gz">commons-cli-1.9.0-bin.tar.gz</a></td>
+              <td><a href="https://downloads.apache.org/commons/cli/binaries/commons-cli-1.9.0-bin.tar.gz.sha512">sha512</a></td>
+              <td><a href="https://downloads.apache.org/commons/cli/binaries/commons-cli-1.9.0-bin.tar.gz.asc">pgp</a></td>
           </tr>
           <tr>
-              <td><a href="[preferred]/commons/cli/binaries/commons-cli-1.8.0-bin.zip">commons-cli-1.8.0-bin.zip</a></td>
-              <td><a href="https://downloads.apache.org/commons/cli/binaries/commons-cli-1.8.0-bin.zip.sha512">sha512</a></td>
-              <td><a href="https://downloads.apache.org/commons/cli/binaries/commons-cli-1.8.0-bin.zip.asc">pgp</a></td>
+              <td><a href="[preferred]/commons/cli/binaries/commons-cli-1.9.0-bin.zip">commons-cli-1.9.0-bin.zip</a></td>
+              <td><a href="https://downloads.apache.org/commons/cli/binaries/commons-cli-1.9.0-bin.zip.sha512">sha512</a></td>
+              <td><a href="https://downloads.apache.org/commons/cli/binaries/commons-cli-1.9.0-bin.zip.asc">pgp</a></td>
           </tr>
         </table>
       </subsection>
       <subsection name="Source">
         <table>
           <tr>
-              <td><a href="[preferred]/commons/cli/source/commons-cli-1.8.0-src.tar.gz">commons-cli-1.8.0-src.tar.gz</a></td>
-              <td><a href="https://downloads.apache.org/commons/cli/source/commons-cli-1.8.0-src.tar.gz.sha512">sha512</a></td>
-              <td><a href="https://downloads.apache.org/commons/cli/source/commons-cli-1.8.0-src.tar.gz.asc">pgp</a></td>
+              <td><a href="[preferred]/commons/cli/source/commons-cli-1.9.0-src.tar.gz">commons-cli-1.9.0-src.tar.gz</a></td>
+              <td><a href="https://downloads.apache.org/commons/cli/source/commons-cli-1.9.0-src.tar.gz.sha512">sha512</a></td>
+              <td><a href="https://downloads.apache.org/commons/cli/source/commons-cli-1.9.0-src.tar.gz.asc">pgp</a></td>
           </tr>
           <tr>
-              <td><a href="[preferred]/commons/cli/source/commons-cli-1.8.0-src.zip">commons-cli-1.8.0-src.zip</a></td>
-              <td><a href="https://downloads.apache.org/commons/cli/source/commons-cli-1.8.0-src.zip.sha512">sha512</a></td>
-              <td><a href="https://downloads.apache.org/commons/cli/source/commons-cli-1.8.0-src.zip.asc">pgp</a></td>
+              <td><a href="[preferred]/commons/cli/source/commons-cli-1.9.0-src.zip">commons-cli-1.9.0-src.zip</a></td>
+              <td><a href="https://downloads.apache.org/commons/cli/source/commons-cli-1.9.0-src.zip.sha512">sha512</a></td>
+              <td><a href="https://downloads.apache.org/commons/cli/source/commons-cli-1.9.0-src.zip.asc">pgp</a></td>
           </tr>
         </table>
       </subsection>


(commons-cli) 05/09: Better parameter name

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-cli.git

commit ab4fed2364a86b1b4fd3dfb596167b48c760bdfb
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Aug 10 08:52:12 2024 -0400

    Better parameter name
    
    Better instance variable name
---
 src/main/java/org/apache/commons/cli/HelpFormatter.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/commons/cli/HelpFormatter.java b/src/main/java/org/apache/commons/cli/HelpFormatter.java
index c62967f..5d0bd75 100644
--- a/src/main/java/org/apache/commons/cli/HelpFormatter.java
+++ b/src/main/java/org/apache/commons/cli/HelpFormatter.java
@@ -84,7 +84,7 @@ public class HelpFormatter {
         /**
          * Formatter for deprecated options.
          */
-        private Function<Option, String> deprecatedFormatFunc = DEFAULT_DEPRECATED_FORMAT;
+        private Function<Option, String> deprecatedFormatFunction = DEFAULT_DEPRECATED_FORMAT;
 
         /**
          * The output PrintWriter, defaults to wrapping {@link System#out}.
@@ -96,7 +96,7 @@ public class HelpFormatter {
 
         @Override
         public HelpFormatter get() {
-            return new HelpFormatter(deprecatedFormatFunc, printStream, showSince);
+            return new HelpFormatter(deprecatedFormatFunction, printStream, showSince);
         }
 
         /**
@@ -123,12 +123,12 @@ public class HelpFormatter {
         /**
          * Sets whether to show deprecated options.
          *
-         * @param showDeprecatedFunc Specify the format for the deprecated options.
+         * @param deprecatedFormatFunction Specify the format for the deprecated options.
          * @return {@code this} instance.
          * @since 1.8.0
          */
-        public Builder setShowDeprecated(final Function<Option, String> showDeprecatedFunc) {
-            this.deprecatedFormatFunc = showDeprecatedFunc;
+        public Builder setShowDeprecated(final Function<Option, String> deprecatedFormatFunction) {
+            this.deprecatedFormatFunction = deprecatedFormatFunction;
             return this;
         }