test_class.file: ljcm-minimal-loader/src/test/java/io/github/leberkleber/ljcm/loader/impl/PropertiesFileLoaderTest.java
test_class.identifier: PropertiesFileLoaderTest
test_case.body: @Test
      public void loadConfigurationsFromFS() throws IOException {
          Path path = null;
          try {
              //given
              path = Files.createTempFile("file-load", "unit-test");
              InputStream propertiesInputStream = PropertiesFileLoaderTest.class.getResourceAsStream("/test.properties");
              Files.copy(propertiesInputStream, path, StandardCopyOption.REPLACE_EXISTING);
              PropertiesFileLoader propertiesFileLoader = new PropertiesFileLoader(path.toAbsolutePath().toString());
  
  
              //when
              Properties properties = propertiesFileLoader.loadConfigurations();
  
  
              //then
              assertNotNull(properties);
              assertEquals(properties.getProperty("thisIsATestProperty"), "someTest");
  
          } finally {
              if (path != null) {
                  Files.delete(path);
              }
          }
      }
test_case.class_method_signature: PropertiesFileLoaderTest.loadConfigurationsFromFS()
test_case.full_signature: @Test public void loadConfigurationsFromFS()
test_case.identifier: loadConfigurationsFromFS
test_case.invocations: createTempFile getResourceAsStream copy toString toAbsolutePath loadConfigurations assertNotNull assertEquals getProperty delete
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void loadConfigurationsFromFS()
focal_class.declarator: LOGGER = Logger.getLogger(PropertiesFileLoader.class.getName())
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = Logger.getLogger(PropertiesFileLoader.class.getName());
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: propertiesFilePath
focal_class.modifier: private
focal_class.original_string: private String propertiesFilePath;
focal_class.type: String
focal_class.var_name: propertiesFilePath
focal_class.file: ljcm-minimal-loader/src/main/java/io/github/leberkleber/ljcm/loader/impl/PropertiesFileLoader.java
focal_class.identifier: PropertiesFileLoader
focal_class.interfaces: implements ConfigurationLoader
focal_class.class_method_signature: PropertiesFileLoader.PropertiesFileLoader(String propertiesFilePath)
focal_class.full_signature: public  PropertiesFileLoader(String propertiesFilePath)
focal_class.identifier: PropertiesFileLoader
focal_class.modifiers: public
focal_class.parameters: (String propertiesFilePath)
focal_class.signature:  PropertiesFileLoader(String propertiesFilePath)
focal_class.class_method_signature: PropertiesFileLoader.loadConfigurations()
focal_class.full_signature: @Override public Properties loadConfigurations()
focal_class.identifier: loadConfigurations
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Properties
focal_class.signature: Properties loadConfigurations()
focal_method.body: @Override
      public Properties loadConfigurations() {
          Properties properties = new Properties();
          InputStream inputStream = null;
  
          try {
              if (propertiesFilePath.startsWith("classpath:")) {
                  String realPropertiesFilePath = propertiesFilePath.split("classpath:")[1];
                  inputStream = PropertiesFileLoader.class.getResourceAsStream(realPropertiesFilePath);
                  if(inputStream == null) {
                      throw new FileNotFoundException(realPropertiesFilePath + " (No such file or directory)");
                  }
              } else {
                  File file = Paths.get(propertiesFilePath).toFile();
                  inputStream = new FileInputStream(file);
              }
  
              properties.load(inputStream);
          } catch (IOException e) {
              throw new RuntimeException("Error while loading properties cause: ", e);
          } finally {
              if(inputStream != null) {
                  try {
                      inputStream.close();
                  } catch (IOException e) {
                      LOGGER.warning("Error while closing inputStream cause: " + e);
                  }
              }
          }
  
          return properties;
      }
focal_method.class_method_signature: PropertiesFileLoader.loadConfigurations()
focal_method.full_signature: @Override public Properties loadConfigurations()
focal_method.identifier: loadConfigurations
focal_method.invocations: startsWith split getResourceAsStream toFile get load close warning
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: Properties
focal_method.signature: Properties loadConfigurations()