refactored commandline parser API for simpler usage
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sun, 20 Oct 2013 08:15:14 +0000 (11:15 +0300)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sun, 20 Oct 2013 08:15:14 +0000 (11:15 +0300)
17 files changed:
src/main/java/eu/svjatoslav/commons/commandline/parameterparser/ArgumentCount.java [new file with mode: 0644]
src/main/java/eu/svjatoslav/commons/commandline/parameterparser/Parameter.java
src/main/java/eu/svjatoslav/commons/commandline/parameterparser/Parser.java
src/main/java/eu/svjatoslav/commons/commandline/parameterparser/arguments/ExistingDirectory.java [deleted file]
src/main/java/eu/svjatoslav/commons/commandline/parameterparser/arguments/ExistingFile.java [deleted file]
src/main/java/eu/svjatoslav/commons/commandline/parameterparser/arguments/IntegerArgument.java [deleted file]
src/main/java/eu/svjatoslav/commons/commandline/parameterparser/arguments/NonExistingDirectory.java [deleted file]
src/main/java/eu/svjatoslav/commons/commandline/parameterparser/arguments/NonExistingFile.java [deleted file]
src/main/java/eu/svjatoslav/commons/commandline/parameterparser/arguments/StringArgument.java [deleted file]
src/main/java/eu/svjatoslav/commons/commandline/parameterparser/parameter/StringParameter.java [new file with mode: 0644]
src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/ExistingDirectory.java [new file with mode: 0755]
src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/ExistingFile.java [new file with mode: 0755]
src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/IntegerArgument.java [new file with mode: 0755]
src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/NonExistingDirectory.java [new file with mode: 0755]
src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/NonExistingFile.java [new file with mode: 0755]
src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/StringArgument.java [new file with mode: 0755]
src/test/java/eu/svjatoslav/commons/commandline/parameterparser/ParserTest.java

diff --git a/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/ArgumentCount.java b/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/ArgumentCount.java
new file mode 100644 (file)
index 0000000..c87c829
--- /dev/null
@@ -0,0 +1,7 @@
+package eu.svjatoslav.commons.commandline.parameterparser;
+
+public enum ArgumentCount {
+
+       NONE, SINGLE, MULTI
+
+}
index 1e738a5..831806d 100755 (executable)
@@ -18,19 +18,17 @@ public class Parameter {
        /**
         * Indicates that at least one argument is mandatory for this parameter.
         */
-       private final boolean mandatory;
-
-       private final boolean enableArguments;
-
-       private final boolean enableMultipleArguments;
+       private boolean mandatory;
 
        private final Argument argumentType;
 
-       private final ArrayList<String> aliases;
+       private final ArrayList<String> aliases = new ArrayList<String>();
+
+       public final String description;
 
-       private final String description;
+       protected final ArrayList<String> arguments = new ArrayList<String>();
 
-       private final ArrayList<String> arguments = new ArrayList<String>();
+       ArgumentCount argumentCount;
 
        /**
         * If this parameter was present in the commandline, then this boolean will
@@ -38,28 +36,36 @@ public class Parameter {
         */
        private boolean parameterSpecified;
 
-       public Parameter(final boolean mandatory, final boolean enableArguments,
-                       final boolean enableMultipleArguments, final Argument argumentType,
-                       final String description, final String... aliases) {
+       public Parameter(final Argument argumentType, final String description,
+                       final ArgumentCount argumentCount) {
+
+               this.description = description;
+               this.argumentType = argumentType;
+               this.argumentCount = argumentCount;
+       };
+
+       public Parameter(final boolean mandatory,
+                       final ArgumentCount argumentCount, final Argument argumentType,
+                       final String description, final String... aliases2) {
 
                this.mandatory = mandatory;
-               this.enableArguments = enableArguments;
-               this.enableMultipleArguments = enableMultipleArguments;
                this.argumentType = argumentType;
                this.description = description;
+               this.argumentCount = argumentCount;
 
                // save aliases
-               {
-                       final ArrayList<String> aliasesList = new ArrayList<String>();
-                       for (final String alias : aliases)
-                               aliasesList.add(alias);
-                       this.aliases = aliasesList;
-               }
+               for (final String alias : aliases2)
+                       aliases.add(alias);
 
        }
 
-       public Parameter(final String description, final String... aliases) {
-               this(false, false, false, null, description, aliases);
+       public Parameter addAliases(final String... aliasArray) {
+
+               // save aliases
+               for (final String alias : aliasArray)
+                       aliases.add(alias);
+
+               return this;
        }
 
        /**
@@ -68,7 +74,7 @@ public class Parameter {
         */
        public boolean addArgument(final String argumentString) {
                // check if arguments are allowed for this parameter
-               if (!enableArguments) {
+               if (argumentCount.equals(ArgumentCount.NONE)) {
                        System.out
                                        .println("Error! No arguments are allowed for parameters: "
                                                        + getAliases());
@@ -76,7 +82,8 @@ public class Parameter {
                }
 
                // check if multiple arguments are allowed
-               if ((arguments.size() > 0) && (!enableMultipleArguments)) {
+               if ((arguments.size() > 0)
+                               && (argumentCount.equals(ArgumentCount.SINGLE))) {
                        System.out
                                        .println("Error! Only single argument is allowed for parameters: "
                                                        + getAliases());
@@ -124,13 +131,6 @@ public class Parameter {
                return Integer.parseInt(arguments.get(0));
        }
 
-       public String getArgumentAsString() {
-               if (arguments.size() != 1)
-                       throw new RuntimeException("Parameter " + description
-                                       + " shall have exactly 1 argument.");
-               return arguments.get(0);
-       }
-
        public List<File> getArgumentsAsFiles() {
                final ArrayList<File> result = new ArrayList<File>();
 
@@ -161,10 +161,10 @@ public class Parameter {
 
                // first line
                buffer.append(getAliases());
-               if (enableArguments) {
+               if (!argumentCount.equals(ArgumentCount.NONE)) {
                        buffer.append(" (" + argumentType.describeFormat() + ")");
 
-                       if (enableMultipleArguments)
+                       if (argumentCount.equals(ArgumentCount.MULTI))
                                buffer.append("...");
                }
                buffer.append("\n");
@@ -206,7 +206,8 @@ public class Parameter {
         */
        public boolean noMoreArguments() {
 
-               if (enableArguments && (arguments.isEmpty())) {
+               if ((!argumentCount.equals(ArgumentCount.NONE))
+                               && (arguments.isEmpty())) {
 
                        System.out.println("Error! " + getAliases()
                                        + " require at least one following argument.");
@@ -216,6 +217,11 @@ public class Parameter {
                return true;
        }
 
+       public Parameter setMandatory() {
+               mandatory = true;
+               return this;
+       }
+
        /**
         * @param parameterSpecified
         *            the parameterSpecified to set
index a72984f..4ab529d 100755 (executable)
@@ -11,6 +11,8 @@ package eu.svjatoslav.commons.commandline.parameterparser;
 
 import java.util.ArrayList;
 
+import eu.svjatoslav.commons.commandline.parameterparser.parameter.StringParameter;
+
 /**
  * <pre>
  * Single commandline parameter can have any amount of arguments.
@@ -24,6 +26,12 @@ public class Parser {
                parameters.add(parameter);
        }
 
+       public StringParameter createStringParameter(final String description) {
+               final StringParameter parameter = new StringParameter(description);
+               parameters.add(parameter);
+               return parameter;
+       }
+
        /**
         * Return parameter by given alias or <code>null</code> if no parameter
         * exists for given alias.
diff --git a/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/arguments/ExistingDirectory.java b/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/arguments/ExistingDirectory.java
deleted file mode 100755 (executable)
index 07341dd..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Svjatoslav Commons - shared library of common functionality.
- * Copyright ©2012-2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- * 
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public License
- * as published by the Free Software Foundation.
- */
-
-package eu.svjatoslav.commons.commandline.parameterparser.arguments;
-
-import java.io.File;
-
-import eu.svjatoslav.commons.commandline.parameterparser.Argument;
-
-public class ExistingDirectory implements Argument {
-
-       @Override
-       public java.lang.String describeFormat() {
-               return "existing directory";
-       }
-
-       @Override
-       public boolean validate(final java.lang.String value) {
-               final File file2 = new File(value);
-               if (file2.exists() && file2.isDirectory())
-                       return true;
-               return false;
-       }
-
-}
diff --git a/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/arguments/ExistingFile.java b/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/arguments/ExistingFile.java
deleted file mode 100755 (executable)
index 676663f..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Svjatoslav Commons - shared library of common functionality.
- * Copyright ©2012-2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- * 
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public License
- * as published by the Free Software Foundation.
- */
-
-package eu.svjatoslav.commons.commandline.parameterparser.arguments;
-
-import java.io.File;
-
-import eu.svjatoslav.commons.commandline.parameterparser.Argument;
-
-public class ExistingFile implements Argument {
-
-       @Override
-       public java.lang.String describeFormat() {
-               return "existing file";
-       }
-
-       @Override
-       public boolean validate(final java.lang.String value) {
-               final File file = new File(value);
-               if (file.exists() && file.isFile())
-                       return true;
-               return false;
-       }
-
-}
diff --git a/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/arguments/IntegerArgument.java b/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/arguments/IntegerArgument.java
deleted file mode 100755 (executable)
index 1d29046..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Svjatoslav Commons - shared library of common functionality.
- * Copyright ©2012-2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- * 
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public License
- * as published by the Free Software Foundation.
- */
-
-package eu.svjatoslav.commons.commandline.parameterparser.arguments;
-
-import eu.svjatoslav.commons.commandline.parameterparser.Argument;
-
-public class IntegerArgument implements Argument {
-
-       @Override
-       public java.lang.String describeFormat() {
-               return "integer";
-       }
-
-       @Override
-       public boolean validate(final java.lang.String value) {
-               try {
-                       java.lang.Integer.valueOf(value);
-                       return true;
-               } catch (final NumberFormatException e) {
-                       return false;
-               }
-       }
-
-}
diff --git a/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/arguments/NonExistingDirectory.java b/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/arguments/NonExistingDirectory.java
deleted file mode 100755 (executable)
index 005077b..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Svjatoslav Commons - shared library of common functionality.
- * Copyright ©2012-2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- * 
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public License
- * as published by the Free Software Foundation.
- */
-
-package eu.svjatoslav.commons.commandline.parameterparser.arguments;
-
-import java.io.File;
-
-import eu.svjatoslav.commons.commandline.parameterparser.Argument;
-
-public class NonExistingDirectory implements Argument {
-
-       @Override
-       public java.lang.String describeFormat() {
-               return "non existing directory";
-       }
-
-       @Override
-       public boolean validate(final java.lang.String value) {
-               final File file4 = new File(value);
-               if (!file4.exists())
-                       return true;
-               return false;
-       }
-
-}
diff --git a/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/arguments/NonExistingFile.java b/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/arguments/NonExistingFile.java
deleted file mode 100755 (executable)
index e4ddeb4..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Svjatoslav Commons - shared library of common functionality.
- * Copyright ©2012-2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- * 
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public License
- * as published by the Free Software Foundation.
- */
-
-package eu.svjatoslav.commons.commandline.parameterparser.arguments;
-
-import java.io.File;
-
-import eu.svjatoslav.commons.commandline.parameterparser.Argument;
-
-public class NonExistingFile implements Argument {
-
-       @Override
-       public java.lang.String describeFormat() {
-               return "non existing file";
-       }
-
-       @Override
-       public boolean validate(final java.lang.String value) {
-               final File file3 = new File(value);
-               if (!file3.exists())
-                       return true;
-               return false;
-       }
-
-}
diff --git a/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/arguments/StringArgument.java b/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/arguments/StringArgument.java
deleted file mode 100755 (executable)
index dd9f588..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Svjatoslav Commons - shared library of common functionality.
- * Copyright ©2012-2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- * 
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public License
- * as published by the Free Software Foundation.
- */
-
-package eu.svjatoslav.commons.commandline.parameterparser.arguments;
-
-import eu.svjatoslav.commons.commandline.parameterparser.Argument;
-
-public class StringArgument implements Argument {
-
-       @Override
-       public java.lang.String describeFormat() {
-               return "string";
-       }
-
-       @Override
-       public boolean validate(final java.lang.String value) {
-               return true;
-       }
-
-}
diff --git a/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/parameter/StringParameter.java b/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/parameter/StringParameter.java
new file mode 100644 (file)
index 0000000..e04b0f3
--- /dev/null
@@ -0,0 +1,27 @@
+package eu.svjatoslav.commons.commandline.parameterparser.parameter;
+
+import eu.svjatoslav.commons.commandline.parameterparser.ArgumentCount;
+import eu.svjatoslav.commons.commandline.parameterparser.Parameter;
+import eu.svjatoslav.commons.commandline.parameterparser.type.StringArgument;
+
+public class StringParameter extends Parameter {
+
+       public StringParameter(final String description) {
+               super(new StringArgument(), description, ArgumentCount.SINGLE);
+       }
+
+       @Override
+       public StringParameter addAliases(final String... aliasArray) {
+               super.addAliases(aliasArray);
+               return this;
+       }
+
+       public String getValue() {
+
+               if (arguments.size() != 1)
+                       throw new RuntimeException("Parameter " + description
+                                       + " shall have exactly 1 argument.");
+
+               return arguments.get(0);
+       }
+}
diff --git a/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/ExistingDirectory.java b/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/ExistingDirectory.java
new file mode 100755 (executable)
index 0000000..2e66255
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Svjatoslav Commons - shared library of common functionality.
+ * Copyright ©2012-2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public License
+ * as published by the Free Software Foundation.
+ */
+
+package eu.svjatoslav.commons.commandline.parameterparser.type;
+
+import java.io.File;
+
+import eu.svjatoslav.commons.commandline.parameterparser.Argument;
+
+public class ExistingDirectory implements Argument {
+
+       @Override
+       public java.lang.String describeFormat() {
+               return "existing directory";
+       }
+
+       @Override
+       public boolean validate(final java.lang.String value) {
+               final File file2 = new File(value);
+               if (file2.exists() && file2.isDirectory())
+                       return true;
+               return false;
+       }
+
+}
diff --git a/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/ExistingFile.java b/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/ExistingFile.java
new file mode 100755 (executable)
index 0000000..d2ce6f4
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Svjatoslav Commons - shared library of common functionality.
+ * Copyright ©2012-2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public License
+ * as published by the Free Software Foundation.
+ */
+
+package eu.svjatoslav.commons.commandline.parameterparser.type;
+
+import java.io.File;
+
+import eu.svjatoslav.commons.commandline.parameterparser.Argument;
+
+public class ExistingFile implements Argument {
+
+       @Override
+       public java.lang.String describeFormat() {
+               return "existing file";
+       }
+
+       @Override
+       public boolean validate(final java.lang.String value) {
+               final File file = new File(value);
+               if (file.exists() && file.isFile())
+                       return true;
+               return false;
+       }
+
+}
diff --git a/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/IntegerArgument.java b/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/IntegerArgument.java
new file mode 100755 (executable)
index 0000000..2dfd300
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Svjatoslav Commons - shared library of common functionality.
+ * Copyright ©2012-2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public License
+ * as published by the Free Software Foundation.
+ */
+
+package eu.svjatoslav.commons.commandline.parameterparser.type;
+
+import eu.svjatoslav.commons.commandline.parameterparser.Argument;
+
+public class IntegerArgument implements Argument {
+
+       @Override
+       public java.lang.String describeFormat() {
+               return "integer";
+       }
+
+       @Override
+       public boolean validate(final java.lang.String value) {
+               try {
+                       java.lang.Integer.valueOf(value);
+                       return true;
+               } catch (final NumberFormatException e) {
+                       return false;
+               }
+       }
+
+}
diff --git a/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/NonExistingDirectory.java b/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/NonExistingDirectory.java
new file mode 100755 (executable)
index 0000000..d8a02bb
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Svjatoslav Commons - shared library of common functionality.
+ * Copyright ©2012-2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public License
+ * as published by the Free Software Foundation.
+ */
+
+package eu.svjatoslav.commons.commandline.parameterparser.type;
+
+import java.io.File;
+
+import eu.svjatoslav.commons.commandline.parameterparser.Argument;
+
+public class NonExistingDirectory implements Argument {
+
+       @Override
+       public java.lang.String describeFormat() {
+               return "non existing directory";
+       }
+
+       @Override
+       public boolean validate(final java.lang.String value) {
+               final File file4 = new File(value);
+               if (!file4.exists())
+                       return true;
+               return false;
+       }
+
+}
diff --git a/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/NonExistingFile.java b/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/NonExistingFile.java
new file mode 100755 (executable)
index 0000000..f3e441e
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Svjatoslav Commons - shared library of common functionality.
+ * Copyright ©2012-2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public License
+ * as published by the Free Software Foundation.
+ */
+
+package eu.svjatoslav.commons.commandline.parameterparser.type;
+
+import java.io.File;
+
+import eu.svjatoslav.commons.commandline.parameterparser.Argument;
+
+public class NonExistingFile implements Argument {
+
+       @Override
+       public java.lang.String describeFormat() {
+               return "non existing file";
+       }
+
+       @Override
+       public boolean validate(final java.lang.String value) {
+               final File file3 = new File(value);
+               if (!file3.exists())
+                       return true;
+               return false;
+       }
+
+}
diff --git a/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/StringArgument.java b/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/type/StringArgument.java
new file mode 100755 (executable)
index 0000000..1ba894a
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Svjatoslav Commons - shared library of common functionality.
+ * Copyright ©2012-2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public License
+ * as published by the Free Software Foundation.
+ */
+
+package eu.svjatoslav.commons.commandline.parameterparser.type;
+
+import eu.svjatoslav.commons.commandline.parameterparser.Argument;
+
+public class StringArgument implements Argument {
+
+       @Override
+       public java.lang.String describeFormat() {
+               return "string";
+       }
+
+       @Override
+       public boolean validate(final java.lang.String value) {
+               return true;
+       }
+
+}
index 0e654b4..e8d1078 100755 (executable)
@@ -16,7 +16,7 @@ import static org.junit.Assert.assertTrue;
 import org.junit.Before;
 import org.junit.Test;
 
-import eu.svjatoslav.commons.commandline.parameterparser.arguments.IntegerArgument;
+import eu.svjatoslav.commons.commandline.parameterparser.parameter.StringParameter;
 
 public class ParserTest {
 
@@ -31,23 +31,17 @@ public class ParserTest {
        public void testParse() {
 
                // define allowed parameters
-               final Parameter helpParameter = new Parameter("Show help screen", "-h",
-                               "--help");
-               parser.addParameter(helpParameter);
+               final StringParameter helpParameter = parser.createStringParameter(
+                               "Show help screen").addAliases("--help", "-h");
 
-               final Parameter compileParameter = new Parameter("Compile code", "-c",
-                               "--compile");
-               parser.addParameter(compileParameter);
-
-               final Parameter bitrateParameter = new Parameter(false, true, false,
-                               new IntegerArgument(), "Target bitrate", "-b", "--bitrate");
-               parser.addParameter(bitrateParameter);
+               final StringParameter compileParameter = parser.createStringParameter(
+                               "Compile code").addAliases("--compile", "-c");
 
                // check help generation
                parser.showHelp();
 
                // parse arguments
-               parser.parse(new String[] { "--help", "-b", "123" });
+               parser.parse(new String[] { "--help", "section" });
 
                // --help was in the arguments
                assertTrue(helpParameter.isParameterSpecified());
@@ -55,11 +49,8 @@ public class ParserTest {
                // compile was not present
                assertFalse(compileParameter.isParameterSpecified());
 
-               // bitrate is given as 123
-               assertTrue(bitrateParameter.isParameterSpecified());
+               // validate that help argument was "section"
+               assertEquals("section", helpParameter.getValue());
 
-               assertEquals(123, (int) bitrateParameter.getArgumentsAsIntegers()
-                               .get(0));
        }
-
 }