Bonjour,

J'ai besoin de charger un fichier properties pour ma classe de test junit via le classpath.

Et je prends un nullpointer... Pourquoi.... ???

Le code en vert marche et en rouge non...

La commande : mvn test -e

Les fichiers se trouvent ds
src\test\java (classes)
src\test\resources (properties)

Je suis en Maven 2 + JDK 1.4 IBM

testDefaultConfiguration2(com.xxxx.tests.propertiesTest) Time elapsed: 0 sec <<< ERROR!
java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Unknown Source)
at java.util.Properties.load(Unknown Source)
at com.xxxx.tests.propertiesTest.testDefaultConfiguration2(propertiesTest.java:95)
public class propertiesTest extends XMLTestCase{

public void testDefaultConfiguration2() throws Exception {

String userPath = System.getProperty("user.dir");
FileInputStream in = new FileInputStream(userPath + "\\src\\test\\resources\\log4j.properties");
Properties properties = new Properties();
properties.load(in);


Properties properties2 = new Properties(); properties2.load(this.getClass().getClassLoader().getResourceAsStream("/log4j.properties"));

}

}
Merci...