### Question:
PropertiesUtils { public static Properties getProperties(String filePath) throws IOException { Properties p; String directoryOfConfigFile = System.getProperty(GlobalConstants.SYSTEM_PATH_NAME); if (!StringUtils.isEmpty(directoryOfConfigFile)) { int len = directoryOfConfigFile.length(); if (len >= 2 && directoryOfConfigFile.endsWith("/")) { directoryOfConfigFile = directoryOfConfigFile.substring(0, len - 1); } else if (len >= 2 && directoryOfConfigFile.endsWith("\\")) { directoryOfConfigFile = directoryOfConfigFile.substring(0, len - 1); } } else { directoryOfConfigFile = "config"; } String newFilePath = directoryOfConfigFile + "/" + filePath; try { try { p = getProperties(newFilePath, false); } catch (IOException e) { p = getProperties(newFilePath, true); } } catch (IOException e) { try { p = getProperties(filePath, false); } catch (IOException e2) { p = getProperties(filePath, true); } } return p; }  static Properties getProperties(String filePath); static int getValidIntegerValue(Properties properties, String key, int defaultValue); static long getValidLongValue(Properties properties, String key, long defaultValue); static double getValidDoubleValue(Properties properties, String key, double defaultValue); static String getStringValue(Properties properties, String key, String defaultValue); static boolean getValidBooleanValue(Properties properties, String key, boolean defaultValue);  }### Answer:
@Test public void getProperties() throws Exception { Properties pros; pros = PropertiesUtils.getProperties(GlobalConstants.CONFIG_FILE_PATH); Assert.assertEquals("5", pros.getProperty("zookeeper.retryNum")); System.setProperty(GlobalConstants.SYSTEM_PATH_NAME, "config"); pros = PropertiesUtils.getProperties(GlobalConstants.CONFIG_FILE_PATH); Assert.assertEquals("5", pros.getProperty("zookeeper.retryNum")); System.setProperty(GlobalConstants.SYSTEM_PATH_NAME, "config/"); pros = PropertiesUtils.getProperties(GlobalConstants.CONFIG_FILE_PATH); Assert.assertEquals("5", pros.getProperty("zookeeper.retryNum")); System.setProperty(GlobalConstants.SYSTEM_PATH_NAME, "config\\"); pros = PropertiesUtils.getProperties(GlobalConstants.CONFIG_FILE_PATH); Assert.assertEquals("5", pros.getProperty("zookeeper.retryNum")); try { System.setProperty(GlobalConstants.SYSTEM_PATH_NAME, "errorDir\\"); PropertiesUtils.getProperties(GlobalConstants.CONFIG_FILE_PATH); Assert.fail(); } catch (IOException e) { } }