PropertiesUtil { public static Properties loadProperties(Logger logger, File configFile) { final Properties properties = new Properties(); if (configFile.exists() && configFile.canRead()) { try (final InputStream in = new FileInputStream(configFile)) { properties.load(in); } catch (final IOException ex) { final String err = "Error loading default settings from " + configFile.getAbsolutePath() + "-file."; logger.error(ex, err); throw new InjectorException(err, ex); } } else { logger.info( "No configuration file '" + configFile.getAbsolutePath() + "' found." ); } return properties; } private  PropertiesUtil(); static Properties loadProperties(Logger logger, File configFile); static void configureParams(T instance, Properties properties, InjectorProxy injectorProxy);  }
@Test void loadProperties() { final Properties properties = PropertiesUtil.loadProperties(LOGGER, file("test.properties")); assertNotNull(properties); assertEquals("1", properties.getProperty("a")); }
@Test void loadPropertiesNoFile() { final Properties properties = PropertiesUtil.loadProperties(LOGGER, new File("jHS%3563qGHGJHg")); assertNotNull(properties); assertTrue(properties.isEmpty()); }
@Test @Disabled("How do we simulate IOException on a file?") void loadPropertiesCorrupted() { assertThrows(InjectorException.class, () -> PropertiesUtil.loadProperties(LOGGER, file("corrupted.properties"))); }