You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.3 KiB
44 lines
1.3 KiB
package de.memtext.util; |
|
|
|
import static org.junit.Assert.assertFalse; |
|
import static org.junit.Assert.assertTrue; |
|
|
|
import java.io.File; |
|
import java.io.IOException; |
|
import java.util.Arrays; |
|
import java.util.Collection; |
|
|
|
import org.junit.Test; |
|
|
|
/** |
|
* Class to test {@link de.memtext.util.FileDeleterThread} |
|
* @author hiber |
|
* |
|
*/ |
|
public class FileDeleterThreadTest { |
|
|
|
@Test |
|
public void testFileDeleterThread() throws IOException { |
|
File testFileOne = new File("test/testFile.one"); |
|
File testFileTwo = new File("test/testFile.two"); |
|
Collection<File> files = Arrays.asList(testFileOne, testFileTwo); |
|
for (File file : files) { |
|
if (file.exists()) { |
|
file.delete(); |
|
} |
|
} |
|
for(File file : files) { |
|
String fileName = file.getName(); |
|
assertFalse("File "+fileName +" does not exist", file.exists()); |
|
assertTrue("File "+fileName +" has been created", file.createNewFile()); |
|
assertTrue("File "+fileName +" exists", file.exists()); |
|
} |
|
new FileDeleterThread(files, 0).run(); |
|
|
|
for(File file : files) { |
|
String fileName = file.getName(); |
|
assertFalse("File "+fileName +" has been deleted", file.exists()); |
|
} |
|
} |
|
|
|
}
|
|
|