Hi
I have a properties file need to be loaded to do unit test. I put the file in the
${maven.src.dir}/test, I write a maven.xml file as follows:
<project
xmlns:j="jelly:core"
xmlns:m="maven"
xmlns:u="jelly:util"
default="java:jar">
<preGoal name="test:test">
<copy
file="${maven.src.dir}/test/jport.properties"
todir="${maven.test.dest}"
/>
</preGoal>
</project>
But I found I cannot load the properties file using the following code in my unit
test:
Properties conf = null;
try
{
InputStream is = ClassLoader.getSystemResourceAsStream("xxx.properties");
if (null != is)
{
conf = new Properties();
conf.load(is);
}
return conf;
}
catch(IOException e)
{
return null;
}
Can u tell me where I am wrong? TIA