test_class.file: herd-code/herd-core/src/test/java/org/finra/herd/core/ArgumentParserTest.java
test_class.identifier: ArgumentParserTest
test_class.superclass: extends AbstractCoreTest
test_case.body: @Test
      public void testGetIntegerValue() throws ParseException
      {
          final Integer testDefaultValue = 500;
          final Integer testMinValue = 0;
          final Integer testMaxValue = 1000;
  
          ArgumentParser argParser = new ArgumentParser("");
          Option intOpt = argParser.addArgument("i", "int", true, "Some integer parameter", false);
          Integer inputValue;
          Integer resultValue;
  
          final String shortIntOpt = String.format("-%s", intOpt.getOpt());
          final String longIntOpt = String.format("--%s", intOpt.getLongOpt());
  
          argParser.parseArguments(new String[] {});
          assertNull(argParser.getIntegerValue(intOpt));
          assertEquals(testDefaultValue, argParser.getIntegerValue(intOpt, testDefaultValue));
  
          inputValue = 123;
          argParser.parseArguments(new String[] {shortIntOpt, inputValue.toString()});
          resultValue = argParser.getIntegerValue(intOpt);
          assertNotNull(resultValue);
          assertEquals(inputValue, resultValue);
  
          inputValue = 456;
          argParser.parseArguments(new String[] {shortIntOpt, inputValue.toString()});
          resultValue = argParser.getIntegerValue(intOpt, testDefaultValue);
          assertNotNull(resultValue);
          assertEquals(inputValue, resultValue);
  
          inputValue = 789;
          argParser.parseArguments(new String[] {longIntOpt, inputValue.toString()});
          resultValue = argParser.getIntegerValue(intOpt);
          assertNotNull(resultValue);
          assertEquals(inputValue, resultValue);
  
          // The "happy path" test case for the minimum and maximum allowed values.
          inputValue = 234;
          argParser.parseArguments(new String[] {longIntOpt, inputValue.toString()});
          resultValue = argParser.getIntegerValue(intOpt, testDefaultValue, testMinValue, testMaxValue);
          assertNotNull(resultValue);
          assertEquals(inputValue, resultValue);
  
          // The default value test case the minimum and maximum allowed values.
          argParser.parseArguments(new String[] {});
          resultValue = argParser.getIntegerValue(intOpt, testDefaultValue, testMinValue, testMaxValue);
          assertNotNull(resultValue);
          assertEquals(testDefaultValue, resultValue);
  
          // The edge test case for the minimum allowed value.
          argParser.parseArguments(new String[] {longIntOpt, testMinValue.toString()});
          resultValue = argParser.getIntegerValue(intOpt, testDefaultValue, testMinValue, testMaxValue);
          assertNotNull(resultValue);
          assertEquals(testMinValue, resultValue);
  
          // The edge test case for the maximum allowed value.
          argParser.parseArguments(new String[] {longIntOpt, testMaxValue.toString()});
          resultValue = argParser.getIntegerValue(intOpt, testDefaultValue, testMinValue, testMaxValue);
          assertNotNull(resultValue);
          assertEquals(testMaxValue, resultValue);
  
          // The edge test case for the minimum and maximum allowed values.
          argParser.parseArguments(new String[] {longIntOpt, testDefaultValue.toString()});
          resultValue = argParser.getIntegerValue(intOpt, testDefaultValue, testDefaultValue, testDefaultValue);
          assertNotNull(resultValue);
          assertEquals(testDefaultValue, resultValue);
  
          // Try to get an option value what is less than the minimum allowed value.
          inputValue = testMinValue - 1;
          argParser.parseArguments(new String[] {longIntOpt, inputValue.toString()});
          try
          {
              argParser.getIntegerValue(intOpt, testDefaultValue, testMinValue, testMaxValue);
              fail("Suppose to throw an IllegalArgumentException when option value is less than the minimum allowed value.");
          }
          catch (IllegalArgumentException e)
          {
              assertEquals(String.format("The %s option value %d is less than the minimum allowed value of %d.", intOpt.getLongOpt(), inputValue, testMinValue),
                  e.getMessage());
          }
  
          // Try to get an option value what is greater than the maximum allowed value.
          inputValue = testMaxValue + 1;
          argParser.parseArguments(new String[] {longIntOpt, inputValue.toString()});
          try
          {
              argParser.getIntegerValue(intOpt, testDefaultValue, testMinValue, testMaxValue);
              fail("Suppose to throw an IllegalArgumentException when option value is greater than the maximum allowed value.");
          }
          catch (IllegalArgumentException e)
          {
              assertEquals(String.format("The %s option value %d is bigger than maximum allowed value of %d.", intOpt.getLongOpt(), inputValue, testMaxValue),
                  e.getMessage());
          }
      }
test_case.class_method_signature: ArgumentParserTest.testGetIntegerValue()
test_case.full_signature: @Test public void testGetIntegerValue()
test_case.identifier: testGetIntegerValue
test_case.invocations: addArgument format getOpt format getLongOpt parseArguments assertNull getIntegerValue assertEquals getIntegerValue parseArguments toString getIntegerValue assertNotNull assertEquals parseArguments toString getIntegerValue assertNotNull assertEquals parseArguments toString getIntegerValue assertNotNull assertEquals parseArguments toString getIntegerValue assertNotNull assertEquals parseArguments getIntegerValue assertNotNull assertEquals parseArguments toString getIntegerValue assertNotNull assertEquals parseArguments toString getIntegerValue assertNotNull assertEquals parseArguments toString getIntegerValue assertNotNull assertEquals parseArguments toString getIntegerValue fail assertEquals format getLongOpt getMessage parseArguments toString getIntegerValue fail assertEquals format getLongOpt getMessage
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetIntegerValue()
focal_class.declarator: applicationName
focal_class.modifier: protected
focal_class.original_string: protected String applicationName;
focal_class.type: String
focal_class.var_name: applicationName
focal_class.declarator: options
focal_class.modifier: protected
focal_class.original_string: protected Options options;
focal_class.type: Options
focal_class.var_name: options
focal_class.declarator: optionsIgnoreRequired
focal_class.modifier: protected
focal_class.original_string: protected Options optionsIgnoreRequired;
focal_class.type: Options
focal_class.var_name: optionsIgnoreRequired
focal_class.declarator: commandLine
focal_class.modifier: protected
focal_class.original_string: protected CommandLine commandLine;
focal_class.type: CommandLine
focal_class.var_name: commandLine
focal_class.file: herd-code/herd-core/src/main/java/org/finra/herd/core/ArgumentParser.java
focal_class.identifier: ArgumentParser
focal_class.class_method_signature: ArgumentParser.ArgumentParser(String applicationName)
focal_class.full_signature: public  ArgumentParser(String applicationName)
focal_class.identifier: ArgumentParser
focal_class.modifiers: public
focal_class.parameters: (String applicationName)
focal_class.signature:  ArgumentParser(String applicationName)
focal_class.class_method_signature: ArgumentParser.getApplicationName()
focal_class.full_signature: public String getApplicationName()
focal_class.identifier: getApplicationName
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getApplicationName()
focal_class.class_method_signature: ArgumentParser.addArgument(Option option, boolean required)
focal_class.full_signature: public Option addArgument(Option option, boolean required)
focal_class.identifier: addArgument
focal_class.modifiers: public
focal_class.parameters: (Option option, boolean required)
focal_class.return: Option
focal_class.signature: Option addArgument(Option option, boolean required)
focal_class.class_method_signature: ArgumentParser.addArgument(String opt, String longOpt, boolean hasArg, String description, boolean required)
focal_class.full_signature: public Option addArgument(String opt, String longOpt, boolean hasArg, String description, boolean required)
focal_class.identifier: addArgument
focal_class.modifiers: public
focal_class.parameters: (String opt, String longOpt, boolean hasArg, String description, boolean required)
focal_class.return: Option
focal_class.signature: Option addArgument(String opt, String longOpt, boolean hasArg, String description, boolean required)
focal_class.class_method_signature: ArgumentParser.getConfiguredOptions()
focal_class.full_signature: public Collection getConfiguredOptions()
focal_class.identifier: getConfiguredOptions
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Collection
focal_class.signature: Collection getConfiguredOptions()
focal_class.class_method_signature: ArgumentParser.parseArguments(String[] args, boolean failOnMissingRequiredOptions)
focal_class.full_signature: public void parseArguments(String[] args, boolean failOnMissingRequiredOptions)
focal_class.identifier: parseArguments
focal_class.modifiers: public
focal_class.parameters: (String[] args, boolean failOnMissingRequiredOptions)
focal_class.return: void
focal_class.signature: void parseArguments(String[] args, boolean failOnMissingRequiredOptions)
focal_class.class_method_signature: ArgumentParser.parseArguments(String[] args)
focal_class.full_signature: public void parseArguments(String[] args)
focal_class.identifier: parseArguments
focal_class.modifiers: public
focal_class.parameters: (String[] args)
focal_class.return: void
focal_class.signature: void parseArguments(String[] args)
focal_class.class_method_signature: ArgumentParser.getUsageInformation()
focal_class.full_signature: public String getUsageInformation()
focal_class.identifier: getUsageInformation
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getUsageInformation()
focal_class.class_method_signature: ArgumentParser.getBooleanValue(Option option)
focal_class.full_signature: @SuppressFBWarnings(value = "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", justification = "This is a false positive. A null check is present.") public Boolean getBooleanValue(Option option)
focal_class.identifier: getBooleanValue
focal_class.modifiers: @SuppressFBWarnings(value = "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", justification = "This is a false positive. A null check is present.") public
focal_class.parameters: (Option option)
focal_class.return: Boolean
focal_class.signature: Boolean getBooleanValue(Option option)
focal_class.class_method_signature: ArgumentParser.getStringValueAsBoolean(Option option, Boolean defaultValue)
focal_class.full_signature: @SuppressFBWarnings(value = "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", justification = "This is a false positive. A null check is present.") public Boolean getStringValueAsBoolean(Option option, Boolean defaultValue)
focal_class.identifier: getStringValueAsBoolean
focal_class.modifiers: @SuppressFBWarnings(value = "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", justification = "This is a false positive. A null check is present.") public
focal_class.parameters: (Option option, Boolean defaultValue)
focal_class.return: Boolean
focal_class.signature: Boolean getStringValueAsBoolean(Option option, Boolean defaultValue)
focal_class.class_method_signature: ArgumentParser.getStringValue(Option option)
focal_class.full_signature: @SuppressFBWarnings(value = "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", justification = "This is a false positive. A null check is present.") public String getStringValue(Option option)
focal_class.identifier: getStringValue
focal_class.modifiers: @SuppressFBWarnings(value = "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", justification = "This is a false positive. A null check is present.") public
focal_class.parameters: (Option option)
focal_class.return: String
focal_class.signature: String getStringValue(Option option)
focal_class.class_method_signature: ArgumentParser.ensureCommandLineNotNull()
focal_class.full_signature: private void ensureCommandLineNotNull()
focal_class.identifier: ensureCommandLineNotNull
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void ensureCommandLineNotNull()
focal_class.class_method_signature: ArgumentParser.getStringValue(Option option, String defaultValue)
focal_class.full_signature: public String getStringValue(Option option, String defaultValue)
focal_class.identifier: getStringValue
focal_class.modifiers: public
focal_class.parameters: (Option option, String defaultValue)
focal_class.return: String
focal_class.signature: String getStringValue(Option option, String defaultValue)
focal_class.class_method_signature: ArgumentParser.getIntegerValue(Option option)
focal_class.full_signature: public Integer getIntegerValue(Option option)
focal_class.identifier: getIntegerValue
focal_class.modifiers: public
focal_class.parameters: (Option option)
focal_class.return: Integer
focal_class.signature: Integer getIntegerValue(Option option)
focal_class.class_method_signature: ArgumentParser.getIntegerValue(Option option, Integer defaultValue)
focal_class.full_signature: public Integer getIntegerValue(Option option, Integer defaultValue)
focal_class.identifier: getIntegerValue
focal_class.modifiers: public
focal_class.parameters: (Option option, Integer defaultValue)
focal_class.return: Integer
focal_class.signature: Integer getIntegerValue(Option option, Integer defaultValue)
focal_class.class_method_signature: ArgumentParser.getIntegerValue(Option option, Integer defaultValue, Integer minValue, Integer maxValue)
focal_class.full_signature: public Integer getIntegerValue(Option option, Integer defaultValue, Integer minValue, Integer maxValue)
focal_class.identifier: getIntegerValue
focal_class.modifiers: public
focal_class.parameters: (Option option, Integer defaultValue, Integer minValue, Integer maxValue)
focal_class.return: Integer
focal_class.signature: Integer getIntegerValue(Option option, Integer defaultValue, Integer minValue, Integer maxValue)
focal_class.class_method_signature: ArgumentParser.getFileValue(Option option)
focal_class.full_signature: public File getFileValue(Option option)
focal_class.identifier: getFileValue
focal_class.modifiers: public
focal_class.parameters: (Option option)
focal_class.return: File
focal_class.signature: File getFileValue(Option option)
focal_class.class_method_signature: ArgumentParser.getFileValue(Option option, File defaultValue)
focal_class.full_signature: public File getFileValue(Option option, File defaultValue)
focal_class.identifier: getFileValue
focal_class.modifiers: public
focal_class.parameters: (Option option, File defaultValue)
focal_class.return: File
focal_class.signature: File getFileValue(Option option, File defaultValue)
focal_method.body: public Integer getIntegerValue(Option option) throws NumberFormatException
      {
          String value = getStringValue(option);
  
          return (value != null) ? Integer.parseInt(value) : null;
      }
focal_method.class_method_signature: ArgumentParser.getIntegerValue(Option option)
focal_method.full_signature: public Integer getIntegerValue(Option option)
focal_method.identifier: getIntegerValue
focal_method.invocations: getStringValue parseInt
focal_method.modifiers: public
focal_method.parameters: (Option option)
focal_method.return: Integer
focal_method.signature: Integer getIntegerValue(Option option)