cleanup before and after file tree test

pull/53/head
Zlatin Balevsky 2020-11-29 08:10:42 +00:00
parent 90988ce717
commit abad1919cc
No known key found for this signature in database
GPG Key ID: A72832072D525E41
1 changed files with 21 additions and 1 deletions

View File

@ -1,9 +1,26 @@
package com.muwire.core.files
import org.junit.After
import org.junit.Before
import org.junit.Test
class FileTreeTest {
@Before
@After
public void cleanup() {
File a = new File("a")
File b = new File("b")
[a,b].each {
if (it.exists()) {
if (it.isDirectory())
it.deleteDir()
else
it.delete()
}
}
}
@Test
public void testRemoveEmtpyDirs() {
File a = new File("a")
@ -108,10 +125,13 @@ class FileTreeTest {
}
File a = new File("a")
a.delete()
a.createNewFile()
File b = new File("b")
b.delete()
b.mkdir()
File c = new File(b, "c")
c.delete()
c.createNewFile()
FileTree<String> tree = new FileTree<>()