### Question:
ConfigUtil { public static Properties loadProperties(String fileName) { if (StringUtil.isNotBlank(fileName)) { if (absolutePathStart(fileName)) { return loadPropertiesFromAbsoluteFile(fileName); } else if (fileName.startsWith(CLASSPATH_FILE_FLAG)) { return loadPropertiesFromClasspathFile(fileName); } else { return loadPropertiesFromRelativeFile(fileName); } } else { return null; } } private  ConfigUtil(); static Properties loadProperties(String fileName); static String addSeparator(String dir); static final String CLASSPATH_FILE_FLAG; }### Answer:
@Test public void testLoadProperties() throws IOException { File file = null; String logOutputType = "utf-8", dir = "/data/logs/", fileName = "propertiesTest.properties"; try { String userDir = System.getProperty("user.dir"); file = new File(addSeparator(userDir) + "target/classes/" + fileName); if (!file.exists()) { file.createNewFile(); } BufferedWriter out = new BufferedWriter(new FileWriter(file)); out.write(LOG_OUTPUT_TYPE + "=" + logOutputType); out.write(System.getProperty("line.separator")); out.write(LOG_DIR + "=" + dir); out.flush(); out.close(); Properties properties = ConfigUtil.loadProperties(file.getAbsolutePath()); Assert.assertTrue(logOutputType.equals(properties.getProperty(LOG_OUTPUT_TYPE))); Assert.assertTrue(dir.equals(properties.getProperty(LOG_DIR))); properties = ConfigUtil.loadProperties(ConfigUtil.CLASSPATH_FILE_FLAG + fileName); Assert.assertTrue(logOutputType.equals(properties.getProperty(LOG_OUTPUT_TYPE))); Assert.assertTrue(dir.equals(properties.getProperty(LOG_DIR))); properties = ConfigUtil.loadProperties("target/classes/" + fileName); Assert.assertTrue(logOutputType.equals(properties.getProperty(LOG_OUTPUT_TYPE))); Assert.assertTrue(dir.equals(properties.getProperty(LOG_DIR))); } finally { if (file != null) { file.delete(); } } }