mercredi 29 avril 2015

Resolving relative path in when running ClasspathSuite

When I run JUnit tests using ClasspathSuite and one of the unit tests wants to load a file using a relative path, it will use the base path of ClasspathSuite instead of the base path of the unit test.

So for example if the unit test tries to load a file like this:

File file = new File("src/test/resources/test.xml");

it will try to load that file relative to the location of ClasspathSuite and not relative to the location of the unit test.

Is there any way to change this?

Aucun commentaire:

Enregistrer un commentaire