FileUtil { public static Properties readPropertiesFromFilename(String propsFilename) { Properties archProps = new Properties(); if (readPropertiesFromClassLoader(propsFilename, archProps, Thread.currentThread().getContextClassLoader()) || readPropertiesFromClassLoader(propsFilename, archProps, ClassLoader.getSystemClassLoader()) || readPropertiesFromClassLoader(propsFilename, archProps, FileUtil.class.getClassLoader())) { return archProps; } LOG.warn("Failed to load default configuration"); return archProps; } private  FileUtil(); static List<String> readFile(String filename); static List<String> readFile(String filename, boolean reportError); static long getLongFromFile(String filename); static long getUnsignedLongFromFile(String filename); static int getIntFromFile(String filename); static String getStringFromFile(String filename); static Map<String, String> getKeyValueMapFromFile(String filename, String separator); static Properties readPropertiesFromFilename(String propsFilename);  }
@Test public void testReadProperties() { Properties props = FileUtil.readPropertiesFromFilename("simplelogger.properties"); assertEquals("INFO", props.getProperty("org.slf4j.simpleLogger.defaultLogLevel")); props = FileUtil.readPropertiesFromFilename("this.file.does.not.exist"); assertFalse(props.elements().hasMoreElements()); }