test_class.declarator: FILESEPARATOR = File.separator
test_class.modifier: private static final
test_class.original_string: private static final String FILESEPARATOR = File.separator;
test_class.type: String
test_class.var_name: FILESEPARATOR
test_class.file: gazeplay-commons/src/test/java/net/gazeplay/commons/utils/multilinguism/I18NTest.java
test_class.identifier: I18NTest
test_case.body: @Test
      void shouldThrowAnErrorWhenCantReadFromLocalFile() {
          final String file = System.getProperty("user.dir") +
              FILESEPARATOR + "src" +
              FILESEPARATOR + "test" +
              FILESEPARATOR + "resources" +
              FILESEPARATOR + "data" +
              FILESEPARATOR + "multilinguism" +
              FILESEPARATOR + "wrong.csv";
          assertThrows(RuntimeException.class, () -> {
              I18N.loadFromFile(file);
          });
      }
test_case.class_method_signature: I18NTest.shouldThrowAnErrorWhenCantReadFromLocalFile()
test_case.full_signature: @Test void shouldThrowAnErrorWhenCantReadFromLocalFile()
test_case.identifier: shouldThrowAnErrorWhenCantReadFromLocalFile
test_case.invocations: getProperty assertThrows loadFromFile
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldThrowAnErrorWhenCantReadFromLocalFile()
focal_class.declarator: translations
focal_class.modifier: private final
focal_class.original_string: private final Map<Entry, String> translations;
focal_class.type: Map<Entry, String>
focal_class.var_name: translations
focal_class.file: gazeplay-commons/src/main/java/net/gazeplay/commons/utils/multilinguism/I18N.java
focal_class.identifier: I18N
focal_class.class_method_signature: I18N.I18N(String resourcePath)
focal_class.full_signature: public  I18N(String resourcePath)
focal_class.identifier: I18N
focal_class.modifiers: public
focal_class.parameters: (String resourcePath)
focal_class.signature:  I18N(String resourcePath)
focal_class.class_method_signature: I18N.loadFromFile(String resourceLocation)
focal_class.full_signature: protected static Map<Entry, String> loadFromFile(String resourceLocation)
focal_class.identifier: loadFromFile
focal_class.modifiers: protected static
focal_class.parameters: (String resourceLocation)
focal_class.return: Map<Entry, String>
focal_class.signature: Map<Entry, String> loadFromFile(String resourceLocation)
focal_class.class_method_signature: I18N.translate(String key, String language)
focal_class.full_signature: public String translate(String key, String language)
focal_class.identifier: translate
focal_class.modifiers: public
focal_class.parameters: (String key, String language)
focal_class.return: String
focal_class.signature: String translate(String key, String language)
focal_method.body: protected static Map<Entry, String> loadFromFile(String resourceLocation) {
          final ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
  
          final InputStream is;
  
          if (new File(resourceLocation).isFile()) {
              try {
                  is = Files.newInputStream(new File(resourceLocation).toPath());
              } catch (IOException ie) {
                  log.error("Exception while reading file {}", resourceLocation, ie);
                  throw new RuntimeException(ie);
              }
          } else {
              is = systemClassLoader.getResourceAsStream(resourceLocation);
          }
  
          try (BufferedReader br = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {
  
              Map<Entry, String> translations = new HashMap<>(1000);
  
              String line;
  
              boolean firstline = true;
  
              String[] languages = null, data;
  
              while ((line = br.readLine()) != null) {
                  if (firstline) {
                      languages = line.split(",");
                      firstline = false;
                  } else {
                      data = line.split(",");
                      String key = data[0].strip();
                      for (int i = 1; i < data.length; i++) {
                          translations.put(new Entry(key, languages[i].strip()), data[i].strip());
                      }
                  }
              }
              return translations;
  
          } catch (Exception e) {
              log.error("Exception while loading resource {}", resourceLocation, e);
              throw new RuntimeException(e);
          }
      }
focal_method.class_method_signature: I18N.loadFromFile(String resourceLocation)
focal_method.full_signature: protected static Map<Entry, String> loadFromFile(String resourceLocation)
focal_method.identifier: loadFromFile
focal_method.invocations: getSystemClassLoader isFile newInputStream toPath error getResourceAsStream readLine split split strip put strip strip error
focal_method.modifiers: protected static
focal_method.parameters: (String resourceLocation)
focal_method.return: Map<Entry, String>
focal_method.signature: Map<Entry, String> loadFromFile(String resourceLocation)