I have a set of unit test cases that depend on the test.properties file. When I run tests on Mac OSX or Linux using Maven ("mvn test"), they work fine. But when working under Windows 7, they cannot find the file unless I copy it directly to the class folder. The code for returning properties is the following two methods:
private void loadProperties() {
try {
properties.load(HibernateTestCase.class.getResourceAsStream(getPropertiesFilePath()));
} catch (Exception ioExc) {
ioExc.printStackTrace();
}
}
private String getPropertiesFilePath() {
return File.separator + "test.properties";
}
What is the real deal here? Is the file path incorrectly set? Thanks in advance!
source
share