@Test void parseConfigFile_doesNotExist() { val randomFileName = RandomStringUtils.randomAlphabetic(10); val path = Paths.get(randomFileName); try { Config.parseConfigFileProperties(path); fail(); } catch (RunnerException e) { assertEquals("Cannot open config file: " + randomFileName, e.getMessage()); } }
static Properties parseConfigFileProperties(final Path configFilePath) throws RunnerException { Properties properties = new Properties(); try (InputStream in = Files.newInputStream(configFilePath)) { properties.load(in); } catch (IOException e) { val error = String.format("Cannot open config file: %s", configFilePath); throw new RunnerException(error, e); } return properties; }
Config { static Properties parseConfigFileProperties(final Path configFilePath) throws RunnerException { Properties properties = new Properties(); try (InputStream in = Files.newInputStream(configFilePath)) { properties.load(in); } catch (IOException e) { val error = String.format("Cannot open config file: %s", configFilePath); throw new RunnerException(error, e); } return properties; } }
Config { static Properties parseConfigFileProperties(final Path configFilePath) throws RunnerException { Properties properties = new Properties(); try (InputStream in = Files.newInputStream(configFilePath)) { properties.load(in); } catch (IOException e) { val error = String.format("Cannot open config file: %s", configFilePath); throw new RunnerException(error, e); } return properties; } private  Config(); }
Config { static Properties parseConfigFileProperties(final Path configFilePath) throws RunnerException { Properties properties = new Properties(); try (InputStream in = Files.newInputStream(configFilePath)) { properties.load(in); } catch (IOException e) { val error = String.format("Cannot open config file: %s", configFilePath); throw new RunnerException(error, e); } return properties; } private  Config();  }
Config { static Properties parseConfigFileProperties(final Path configFilePath) throws RunnerException { Properties properties = new Properties(); try (InputStream in = Files.newInputStream(configFilePath)) { properties.load(in); } catch (IOException e) { val error = String.format("Cannot open config file: %s", configFilePath); throw new RunnerException(error, e); } return properties; } private  Config();   }