PropertyFileDAO { public String getProperty(String propertyFileName, String propertyName) throws PropertyAccessException { PropertiesConfiguration properties = propertyFilesHashmap.get(propertyFileName); if (properties != null && properties.containsKey(propertyName)) { String propertyValue = properties.getString(propertyName); if (NullChecker.isNotNullish(propertyValue)) { return propertyValue.trim(); } } return null; } PropertyFileDAO(); void loadPropertyFile(File propertyFile, String propertyFileName); String getProperty(String propertyFileName, String propertyName); void setProperty(String propertyFileName, String key, Object value); String getPropertyComment(String propertyFileName, String key); boolean getPropertyBoolean(String propertyFileName, String propertyName); long getPropertyLong(String propertyFileName, String propertyName); Long getPropertyLongObject(String propertyFileName, String propertyName, Long defaultValue); Set<String> getPropertyNames(String propertyFileName); Properties getProperties(String propertyFileName); void printToLog(String propertyFileName); boolean containsPropFile(String fileName);  }
@Test public void testGetProperty() throws PropertyAccessException { PropertyFileDAO propDAO = loadTestProperties(); assertTrue(propDAO.getProperty(TEST_PROPERTIES_NAME, "stringTest").equals("test123")); assertNull(propDAO.getProperty(TEST_PROPERTIES_NAME, "nonexistantfield")); assertNull(propDAO.getProperty("nonexistant", "stringTest")); }
@Test public void testGetPropertyWithComma() throws PropertyAccessException { PropertyFileDAO propDAO = loadTestProperties(); assertTrue(propDAO.getProperty(TEST_PROPERTIES_NAME, "stringWithCommaTest").equals("test1,test2,test3,test4")); }