test_class.file: tf-build-tools/tf-cmd-api/src/test/java/com/deliveredtechnologies/terraform/api/converters/TfCliOptionBuilderTest.java
test_class.identifier: TfCliOptionBuilderTest
test_case.body: @Test
    public void convert() throws IOException, TerraformException {
      Properties properties = new Properties();
      properties.put(TerraformApply.Option.tfVarFiles.getPropertyName(), "test1.txt, test2.txt");
      properties.put(TerraformApply.Option.tfVars.getPropertyName(), "key1=value1, key2=value2");
      properties.put(TerraformApply.Option.lockTimeout.getPropertyName(), "1000");
      properties.put(TerraformApply.Option.target.getPropertyName(), "module1.module2");
      properties.put(TerraformApply.Option.noColor.getPropertyName(), "true");
      properties.put(TerraformApply.Option.plan.getPropertyName(), "someplan.tfplan");
      properties.put(TerraformApply.Option.refreshState.getPropertyName(), "true");
      properties.put(TerraformApply.Option.autoApprove.getPropertyName(), "true");
  
  
      TfCliOptionBuilder tfCliOptionBuilder = new TfCliOptionBuilder(TfCliOptionBuilder.initializeFormatterRegistry());
      String options = tfCliOptionBuilder.convert(TerraformApply.Option.values(), properties);
  
      Assert.assertThat(options, CoreMatchers.containsString("-var \"key1=value1\" -var \"key2=value2\" "));
      Assert.assertThat(options, CoreMatchers.containsString("-var-file=test1.txt -var-file=test2.txt "));
      Assert.assertThat(options, CoreMatchers.containsString("-lock-timeout=1000 "));
      Assert.assertThat(options, CoreMatchers.containsString("-target=module1.module2 "));
      Assert.assertThat(options, CoreMatchers.containsString("-no-color "));
      Assert.assertThat(options, CoreMatchers.containsString("-auto-approve "));
      Assert.assertThat(options, CoreMatchers.containsString("-refresh=true "));
      Assert.assertThat(options, CoreMatchers.endsWith("someplan.tfplan "));
    }
test_case.class_method_signature: TfCliOptionBuilderTest.convert()
test_case.full_signature: @Test public void convert()
test_case.identifier: convert
test_case.invocations: put getPropertyName put getPropertyName put getPropertyName put getPropertyName put getPropertyName put getPropertyName put getPropertyName put getPropertyName initializeFormatterRegistry convert values assertThat containsString assertThat containsString assertThat containsString assertThat containsString assertThat containsString assertThat containsString assertThat containsString assertThat endsWith
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void convert()
focal_class.declarator: registry
focal_class.modifier: private
focal_class.original_string: private Map<String, TfOptionFormatter> registry;
focal_class.type: Map<String, TfOptionFormatter>
focal_class.var_name: registry
focal_class.file: tf-build-tools/tf-cmd-api/src/main/java/com/deliveredtechnologies/terraform/api/converters/TfCliOptionBuilder.java
focal_class.identifier: TfCliOptionBuilder
focal_class.class_method_signature: TfCliOptionBuilder.TfCliOptionBuilder(Map<String, TfOptionFormatter> registry)
focal_class.full_signature: public  TfCliOptionBuilder(Map<String, TfOptionFormatter> registry)
focal_class.identifier: TfCliOptionBuilder
focal_class.modifiers: public
focal_class.parameters: (Map<String, TfOptionFormatter> registry)
focal_class.signature:  TfCliOptionBuilder(Map<String, TfOptionFormatter> registry)
focal_class.class_method_signature: TfCliOptionBuilder.convert(TerraformOption[] params, Properties properties)
focal_class.full_signature: public String convert(TerraformOption[] params, Properties properties)
focal_class.identifier: convert
focal_class.modifiers: public
focal_class.parameters: (TerraformOption[] params, Properties properties)
focal_class.return: String
focal_class.signature: String convert(TerraformOption[] params, Properties properties)
focal_class.class_method_signature: TfCliOptionBuilder.initializeFormatterRegistry()
focal_class.full_signature: public static Map<String, TfOptionFormatter> initializeFormatterRegistry()
focal_class.identifier: initializeFormatterRegistry
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: Map<String, TfOptionFormatter>
focal_class.signature: Map<String, TfOptionFormatter> initializeFormatterRegistry()
focal_method.body: public String convert(TerraformOption[] params, Properties properties) throws TerraformException {
      StringBuilder sb = new StringBuilder();
  
      for (TerraformOption param : params) { //iterate over all the supported parameters associated with the operation
  
        if (properties.containsKey(param.getPropertyName()) || param.getDefault() != null) {
          //get converter from registry
          TfOptionFormatter converter = Optional.ofNullable(registry.get(param.toString().toLowerCase()))
              .orElse(registry.get("default"));
          sb.append(converter.convert(param.getFormat(), properties.getOrDefault(param.getPropertyName(), param.getDefault())));
        }
      }
      return sb.toString();
    }
focal_method.class_method_signature: TfCliOptionBuilder.convert(TerraformOption[] params, Properties properties)
focal_method.full_signature: public String convert(TerraformOption[] params, Properties properties)
focal_method.identifier: convert
focal_method.invocations: containsKey getPropertyName getDefault orElse ofNullable get toLowerCase toString get append convert getFormat getOrDefault getPropertyName getDefault toString
focal_method.modifiers: public
focal_method.parameters: (TerraformOption[] params, Properties properties)
focal_method.return: String
focal_method.signature: String convert(TerraformOption[] params, Properties properties)