vendredi 4 septembre 2015

Path of saved file in a unit test with Junit

In a Java application, I have a method of a class that saves a file just using its name.

    final File file = new File("XXX.txt");
    file.createNewFile();

Then, in a unit test with JUnit 4, I run the class that execute the method and I see a file created with name XXX.txt in the root folder of the project.

How can I get this path dynamically such that I can use a @After method to delete it?

Aucun commentaire:

Enregistrer un commentaire