test_class.file: kilt-core/src/test/java/de/poiu/kilt/bundlecontent/ResourceBundleContentHelperTest.java
test_class.identifier: ResourceBundleContentHelperTest
test_case.body: @Test
    public void testToBundleNameToFilesMap_IgnoreSubDir() {
      // preparation
      final Path ignorableBasePath= Paths.get("/some/path/src/main/resources");
  
      final List<File> resourceFiles= ImmutableList.of(
              ignorableBasePath.resolve("messages_de.properties").toFile(),
              ignorableBasePath.resolve("messages_en.properties").toFile(),
              ignorableBasePath.resolve("options.properties").toFile(),
              ignorableBasePath.resolve("options_en_US.properties").toFile(),
              ignorableBasePath.resolve("options_en_GB.properties").toFile()
      );
  
      // execution
      final ResourceBundleContentHelper helper= new ResourceBundleContentHelper(ignorableBasePath);
      final Map<String, Map<Language, File>> bundleNameToFilesMap = helper.toBundleNameToFilesMap(resourceFiles);
  
      System.out.println(bundleNameToFilesMap.keySet());
      // verification
      assertThat(bundleNameToFilesMap.keySet()).containsExactly("messages", "options");
      assertThat(bundleNameToFilesMap.get("messages")).containsKeys(Language.of("de"), Language.of("en"));
      assertThat(bundleNameToFilesMap.get("messages").get(Language.of("de"))).hasName("messages_de.properties");
      assertThat(bundleNameToFilesMap.get("messages").get(Language.of("en"))).hasName("messages_en.properties");
      assertThat(bundleNameToFilesMap.get("options")).containsKeys(Language.of(""), Language.of("en_US"), Language.of("en_GB"));
      assertThat(bundleNameToFilesMap.get("options").get(Language.of(""))).hasName("options.properties");
      assertThat(bundleNameToFilesMap.get("options").get(Language.of("en_US"))).hasName("options_en_US.properties");
      assertThat(bundleNameToFilesMap.get("options").get(Language.of("en_GB"))).hasName("options_en_GB.properties");
    }
test_case.class_method_signature: ResourceBundleContentHelperTest.testToBundleNameToFilesMap_IgnoreSubDir()
test_case.full_signature: @Test public void testToBundleNameToFilesMap_IgnoreSubDir()
test_case.identifier: testToBundleNameToFilesMap_IgnoreSubDir
test_case.invocations: get of toFile resolve toFile resolve toFile resolve toFile resolve toFile resolve toBundleNameToFilesMap println keySet containsExactly assertThat keySet containsKeys assertThat get of of hasName assertThat get get of hasName assertThat get get of containsKeys assertThat get of of of hasName assertThat get get of hasName assertThat get get of hasName assertThat get get of
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testToBundleNameToFilesMap_IgnoreSubDir()
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: PATTERN_RESOURCE_BUNDLE_FILE_NAME= Pattern.compile(
          "(?<BUNDLE>[a-zA-Z0-9\\-]+)"                                      //the bundle basename (mandatory)
        + "(?:_"                                                            //ignore the underscore of the optional LANG
        +   "(?<LOCALE>"                                                    //a group capturing all locale parts (LANG, SCRIPT, COUNTRY and VARIANT)
        +     "(?<LANG>[a-zA-Z]{2,8})"                                        //the optional LANG
        +     "(?:_"                                                          //ignore the underscore of the optional SCRIPT
        +       "(?<SCRIPT>[a-zA-Z]{4})"                                      //the optional SCRIPT
        +     ")?"
        +     "(?:_"                                                          //ignore the underscore of the optional COUNTRY
        +       "(?<COUNTRY>[a-zA-Z]{2}|[0-9]{3})"                            //the optional COUNTRY
        +     ")?"
        +     "(?:_"                                                          //ignore the underscore of the optional VARIANT
        +       "(?<VARIANT>[0-9a-zA-Z-]+.)"                                  //the optional VARIANT
        +     ")?"
        +   ")"
        + ")?"
        + "\\.properties"                                                   // the file must always have the suffix .properties
      , Pattern.UNICODE_CHARACTER_CLASS)
focal_class.modifier: protected static final
focal_class.original_string: protected static final Pattern PATTERN_RESOURCE_BUNDLE_FILE_NAME= Pattern.compile(
          "(?<BUNDLE>[a-zA-Z0-9\\-]+)"                                      //the bundle basename (mandatory)
        + "(?:_"                                                            //ignore the underscore of the optional LANG
        +   "(?<LOCALE>"                                                    //a group capturing all locale parts (LANG, SCRIPT, COUNTRY and VARIANT)
        +     "(?<LANG>[a-zA-Z]{2,8})"                                        //the optional LANG
        +     "(?:_"                                                          //ignore the underscore of the optional SCRIPT
        +       "(?<SCRIPT>[a-zA-Z]{4})"                                      //the optional SCRIPT
        +     ")?"
        +     "(?:_"                                                          //ignore the underscore of the optional COUNTRY
        +       "(?<COUNTRY>[a-zA-Z]{2}|[0-9]{3})"                            //the optional COUNTRY
        +     ")?"
        +     "(?:_"                                                          //ignore the underscore of the optional VARIANT
        +       "(?<VARIANT>[0-9a-zA-Z-]+.)"                                  //the optional VARIANT
        +     ")?"
        +   ")"
        + ")?"
        + "\\.properties"                                                   // the file must always have the suffix .properties
      , Pattern.UNICODE_CHARACTER_CLASS);
focal_class.type: Pattern
focal_class.var_name: PATTERN_RESOURCE_BUNDLE_FILE_NAME
focal_class.declarator: ignorableBasePath= Paths.get("")
focal_class.modifier: private
focal_class.original_string: private Path ignorableBasePath= Paths.get("");
focal_class.type: Path
focal_class.var_name: ignorableBasePath
focal_class.file: kilt-core/src/main/java/de/poiu/kilt/bundlecontent/ResourceBundleContentHelper.java
focal_class.identifier: ResourceBundleContentHelper
focal_class.class_method_signature: ResourceBundleContentHelper.ResourceBundleContentHelper()
focal_class.full_signature: public  ResourceBundleContentHelper()
focal_class.identifier: ResourceBundleContentHelper
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  ResourceBundleContentHelper()
focal_class.class_method_signature: ResourceBundleContentHelper.ResourceBundleContentHelper(final File ignorableBasePath)
focal_class.full_signature: public  ResourceBundleContentHelper(final File ignorableBasePath)
focal_class.identifier: ResourceBundleContentHelper
focal_class.modifiers: public
focal_class.parameters: (final File ignorableBasePath)
focal_class.signature:  ResourceBundleContentHelper(final File ignorableBasePath)
focal_class.class_method_signature: ResourceBundleContentHelper.ResourceBundleContentHelper(final Path ignorableBasePath)
focal_class.full_signature: public  ResourceBundleContentHelper(final Path ignorableBasePath)
focal_class.identifier: ResourceBundleContentHelper
focal_class.modifiers: public
focal_class.parameters: (final Path ignorableBasePath)
focal_class.signature:  ResourceBundleContentHelper(final Path ignorableBasePath)
focal_class.class_method_signature: ResourceBundleContentHelper.toBundleNameToFilesMap(final Collection<File> propertyFiles)
focal_class.full_signature: public Map<String, Map<Language, File>> toBundleNameToFilesMap(final Collection<File> propertyFiles)
focal_class.identifier: toBundleNameToFilesMap
focal_class.modifiers: public
focal_class.parameters: (final Collection<File> propertyFiles)
focal_class.return: Map<String, Map<Language, File>>
focal_class.signature: Map<String, Map<Language, File>> toBundleNameToFilesMap(final Collection<File> propertyFiles)
focal_class.class_method_signature: ResourceBundleContentHelper.getBundlePrefix(final Path path)
focal_class.full_signature: protected String getBundlePrefix(final Path path)
focal_class.identifier: getBundlePrefix
focal_class.modifiers: protected
focal_class.parameters: (final Path path)
focal_class.return: String
focal_class.signature: String getBundlePrefix(final Path path)
focal_class.class_method_signature: ResourceBundleContentHelper.getBundlePrefix(final File file)
focal_class.full_signature: protected String getBundlePrefix(final File file)
focal_class.identifier: getBundlePrefix
focal_class.modifiers: protected
focal_class.parameters: (final File file)
focal_class.return: String
focal_class.signature: String getBundlePrefix(final File file)
focal_method.body: public Map<String, Map<Language, File>> toBundleNameToFilesMap(final Collection<File> propertyFiles) {
      Require.nonNull(propertyFiles);
      final Map<String, Map<Language, File>> result= new LinkedHashMap<>();
  
      for (final File file : propertyFiles) {
        final Matcher matcher = PATTERN_RESOURCE_BUNDLE_FILE_NAME.matcher(file.getName());
        if (matcher.matches()) {
          final String bundleBasename= matcher.group("BUNDLE");
          final String langCode= matcher.group("LOCALE");
          final Language language= Language.of(langCode != null ? langCode : "");
  
          final String bundlePrefix= getBundlePrefix(file);
          final String fullBundleName;
          if (bundlePrefix == null || bundlePrefix.trim().isEmpty()) {
            fullBundleName= bundleBasename;
          } else {
            fullBundleName= bundlePrefix + "/" + bundleBasename;
          }
  
          if (!result.containsKey(fullBundleName)) {
            result.put(fullBundleName, new LinkedHashMap<>());
          }
  
          final Map<Language, File> langToFileMap= result.get(fullBundleName);
          if (langToFileMap.containsKey(language)) {
            throw new RuntimeException("Language "+langCode+" already in map. Should never happen.");
          }
          langToFileMap.put(language, file);
        } else {
          LOGGER.log(Level.WARN, "File {} doesn't match the expected pattern. It will not be processed! Does your file name end with .properties?", file.getAbsolutePath());
        }
      }
  
      return result;
    }
focal_method.class_method_signature: ResourceBundleContentHelper.toBundleNameToFilesMap(final Collection<File> propertyFiles)
focal_method.full_signature: public Map<String, Map<Language, File>> toBundleNameToFilesMap(final Collection<File> propertyFiles)
focal_method.identifier: toBundleNameToFilesMap
focal_method.invocations: nonNull matcher getName matches group group of getBundlePrefix isEmpty trim containsKey put get containsKey put log getAbsolutePath
focal_method.modifiers: public
focal_method.parameters: (final Collection<File> propertyFiles)
focal_method.return: Map<String, Map<Language, File>>
focal_method.signature: Map<String, Map<Language, File>> toBundleNameToFilesMap(final Collection<File> propertyFiles)