com.usmanhussain.sonora.ApplicationProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Sonora Show documentation
Show all versions of Sonora Show documentation
com.usmanhussain.sonora - Sonora allows accessibility and compatibility requirements to be automated within a DevOps, Agile or
Waterfall (unfortunately) platform. Running inline with Selenium and Cucumber frameworks
The newest version!
package com.usmanhussain.sonora;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class ApplicationProperties {
Properties properties;
public ApplicationProperties(String fileName) throws IOException {
this.properties = readFile(fileName);
}
public Properties readFile(String fileName) {
Properties properties = new Properties();
try {
InputStream inputStream = getClass().getClassLoader().getResourceAsStream(fileName);
if (inputStream != null) {
properties.load(inputStream);
}
inputStream.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return properties;
}
public String getProperty(String property) {
return this.properties.getProperty(property);
}
}