horizon-test/src/main/java/com/utopiadeals/utils/PropertyReader.java

32 lines
917 B
Java

package com.utopiadeals.utils;
import com.utopiadeals.utils.config.Constants;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.Properties;
public class PropertyReader {
private static final Logger LOGGER = LogManager.getLogger();
private final Properties properties;
/**
* Instantiates a new Property reader with the provided properties file
*/
public PropertyReader() {
LOGGER.debug("Loading properties from config/{}", Constants.PROPERTIES_NAME);
this.properties = FileIoHelper.loadPropertiesFromClasspath(Constants.PROPERTIES_NAME);
}
/**
* Gets string property value by name
*
* @param propertyName the property name
* @return the string value or null if not found
*/
public String getString(String propertyName) {
return properties.getProperty(propertyName);
}
}