test_class.declarator: tmpFolder= new TemporaryFolder()
test_class.modifier: @Rule
    public
test_class.original_string: @Rule
    public TemporaryFolder tmpFolder= new TemporaryFolder();
test_class.type: TemporaryFolder
test_class.var_name: tmpFolder
test_class.file: kilt-core/src/test/java/de/poiu/kilt/reformatting/KiltReformatterTest.java
test_class.identifier: KiltReformatterTest
test_case.body: @Test
    public void testReorder_orderByLanguage_SameFileTwice() throws IOException {
  
      // - preparation
  
      final Path propertiesRootDirectory= this.tmpFolder.getRoot().toPath();
      final File f1= createI18nBundle(propertiesRootDirectory, ""
        + "keyC = valueC\n"
        + "keyB = valueB\n"
        + "keyA = valueA\n"
        + "keyE = valueE\n"
        + "keyD = valueD\n"
      );
      final File f2= createI18nBundle(propertiesRootDirectory, ""
        + "keyE = valueE\n"
        + "keyD = valueD\n"
        + "keyC = valueC\n"
        + "keyB = valueB\n"
        + "keyA = valueA\n"
      );
  
      final FileMatcher fileMatcher= new FileMatcher(propertiesRootDirectory, new String[]{"**/*.properties"}, new String[]{""});
  
      // - execution
  
      new KiltReformatter()
        .reorderByTemplate(f1, fileMatcher, AttachCommentsTo.NEXT_PROPERTY, UTF_8);
  
      // - verification
  
      assertThat(contentOf(f1)).isEqualTo(""
        + "keyC = valueC\n"
        + "keyB = valueB\n"
        + "keyA = valueA\n"
        + "keyE = valueE\n"
        + "keyD = valueD\n"
      );
      assertThat(contentOf(f2)).isEqualTo(""
        + "keyC = valueC\n"
        + "keyB = valueB\n"
        + "keyA = valueA\n"
        + "keyE = valueE\n"
        + "keyD = valueD\n"
      );
    }
test_case.class_method_signature: KiltReformatterTest.testReorder_orderByLanguage_SameFileTwice()
test_case.full_signature: @Test public void testReorder_orderByLanguage_SameFileTwice()
test_case.identifier: testReorder_orderByLanguage_SameFileTwice
test_case.invocations: toPath getRoot createI18nBundle createI18nBundle reorderByTemplate isEqualTo assertThat contentOf isEqualTo assertThat contentOf
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testReorder_orderByLanguage_SameFileTwice()
focal_class.declarator: LOGGER= LogManager.getLogger()
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER= LogManager.getLogger();
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: APRON_OPTIONS= ApronOptions.create()
          .with(MissingKeyAction.NOTHING)
          .with(UnicodeHandling.DO_NOTHING)
focal_class.modifier: private static final
focal_class.original_string: private static final ApronOptions APRON_OPTIONS= ApronOptions.create()
          .with(MissingKeyAction.NOTHING)
          .with(UnicodeHandling.DO_NOTHING);
focal_class.type: ApronOptions
focal_class.var_name: APRON_OPTIONS
focal_class.file: kilt-core/src/main/java/de/poiu/kilt/reformatting/KiltReformatter.java
focal_class.identifier: KiltReformatter
focal_class.class_method_signature: KiltReformatter.reformat(final FileMatcher fileMatcher, final String formatString, final boolean reformatKeyAndValue, final Charset charset)
focal_class.full_signature: public void reformat(final FileMatcher fileMatcher, final String formatString, final boolean reformatKeyAndValue, final Charset charset)
focal_class.identifier: reformat
focal_class.modifiers: public
focal_class.parameters: (final FileMatcher fileMatcher, final String formatString, final boolean reformatKeyAndValue, final Charset charset)
focal_class.return: void
focal_class.signature: void reformat(final FileMatcher fileMatcher, final String formatString, final boolean reformatKeyAndValue, final Charset charset)
focal_class.class_method_signature: KiltReformatter.reorderByKey(final FileMatcher fileMatcher, final AttachCommentsTo attachCommentsTo, final Charset charset)
focal_class.full_signature: public void reorderByKey(final FileMatcher fileMatcher, final AttachCommentsTo attachCommentsTo, final Charset charset)
focal_class.identifier: reorderByKey
focal_class.modifiers: public
focal_class.parameters: (final FileMatcher fileMatcher, final AttachCommentsTo attachCommentsTo, final Charset charset)
focal_class.return: void
focal_class.signature: void reorderByKey(final FileMatcher fileMatcher, final AttachCommentsTo attachCommentsTo, final Charset charset)
focal_class.class_method_signature: KiltReformatter.reorderByTemplate(final File template, final FileMatcher fileMatcher, final AttachCommentsTo attachCommentsTo, final Charset charset)
focal_class.full_signature: public void reorderByTemplate(final File template, final FileMatcher fileMatcher, final AttachCommentsTo attachCommentsTo, final Charset charset)
focal_class.identifier: reorderByTemplate
focal_class.modifiers: public
focal_class.parameters: (final File template, final FileMatcher fileMatcher, final AttachCommentsTo attachCommentsTo, final Charset charset)
focal_class.return: void
focal_class.signature: void reorderByTemplate(final File template, final FileMatcher fileMatcher, final AttachCommentsTo attachCommentsTo, final Charset charset)
focal_method.body: public void reorderByTemplate(final File template, final FileMatcher fileMatcher, final AttachCommentsTo attachCommentsTo, final Charset charset) {
      Require.nonNull(fileMatcher);
      Require.nonNull(attachCommentsTo);
      Require.nonNull(charset);
  
      final Set<File> propertyFiles= fileMatcher.findMatchingFiles();
      LOGGER.log(Level.INFO, "Reordering entries by template {} in the following files: {}", template, propertyFiles);
  
      // create a PropertyFile instance for each file
      final PropertyFile reference= PropertyFile.from(template, charset);
      final Set<RememberingPropertyFile> pfs= propertyFiles.stream()
        .filter(_f -> {
          if (_f.getAbsolutePath().equals(template.getAbsolutePath())) {
            LOGGER.log(Level.DEBUG, "Ignoring property file "+_f.getAbsolutePath()+" because it is the same as the reference template.");
            return false;
          } else {
            return true;
          }
        })
        .map(_f -> {
          return RememberingPropertyFile.from(_f, charset);
        })
        .collect(Collectors.toSet());
  
  //    // and reorder in the given order
  //    for (int i= 1; i < pfs.size(); i++) {
  //      final RememberingPropertyFile rpf= pfs.get(i);
  //      new Reformatter().reorderByTemplate(pfs.get(i - 1).propertyFile, rpf.propertyFile, attachCommentsTo);
  //      rpf.propertyFile.overwrite(rpf.actualFile);
  //    }
  
      // and reorder them
      final Reformatter reformatter= new Reformatter(
      ReformatOptions.create()
        .with(charset)
        .with(attachCommentsTo));
  
      for (final RememberingPropertyFile rpf : pfs) {
        reformatter.reorderByTemplate(reference, rpf.propertyFile);
        rpf.propertyFile.overwrite(rpf.actualFile, APRON_OPTIONS.with(charset));
      }
    }
focal_method.class_method_signature: KiltReformatter.reorderByTemplate(final File template, final FileMatcher fileMatcher, final AttachCommentsTo attachCommentsTo, final Charset charset)
focal_method.full_signature: public void reorderByTemplate(final File template, final FileMatcher fileMatcher, final AttachCommentsTo attachCommentsTo, final Charset charset)
focal_method.identifier: reorderByTemplate
focal_method.invocations: nonNull nonNull nonNull findMatchingFiles log from collect map filter stream equals getAbsolutePath getAbsolutePath log getAbsolutePath from toSet with with create reorderByTemplate overwrite with
focal_method.modifiers: public
focal_method.parameters: (final File template, final FileMatcher fileMatcher, final AttachCommentsTo attachCommentsTo, final Charset charset)
focal_method.return: void
focal_method.signature: void reorderByTemplate(final File template, final FileMatcher fileMatcher, final AttachCommentsTo attachCommentsTo, final Charset charset)