I am trying to write a Junit test for a java code that with three methods.
fileDeletion.java
public static void fileDeletion(String filePath){
File file = new File(filePath);
file.delete();
}
I looked online on how to test this but it cam up with how to make a temporary file in JUnit which is 'guaranteed to be deleted after the test finishes'. See: https://howtodoinjava.com/junit/junit-creating-temporary-filefolder-using-temporaryfolder-rule/ How do I make a file which can be created and then subsequently deleted in a JUnit Test?
Any help would go a long way, many thanks.
Aucun commentaire:
Enregistrer un commentaire