Remove the created temporary directory after the test again
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1746060 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a48bfc0281
commit
d53ad74c37
@ -26,6 +26,7 @@ import java.io.FileOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import org.apache.poi.poifs.dev.TestPOIFSDump;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -47,7 +48,7 @@ public class TestTempFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void tearDown() {
|
public void tearDown() throws IOException {
|
||||||
String[] files = tempDir.list();
|
String[] files = tempDir.list();
|
||||||
// can have the "poifiles" subdir
|
// can have the "poifiles" subdir
|
||||||
if(files.length == 1) {
|
if(files.length == 1) {
|
||||||
@ -58,6 +59,9 @@ public class TestTempFile {
|
|||||||
assertEquals("Had: " + Arrays.toString(files), 0, files.length);
|
assertEquals("Had: " + Arrays.toString(files), 0, files.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remove the directory after the tests
|
||||||
|
TestPOIFSDump.deleteDirectory(tempDir);
|
||||||
|
|
||||||
if(previousTempDir == null) {
|
if(previousTempDir == null) {
|
||||||
System.clearProperty(TempFile.JAVA_IO_TMPDIR);
|
System.clearProperty(TempFile.JAVA_IO_TMPDIR);
|
||||||
} else {
|
} else {
|
||||||
@ -66,8 +70,7 @@ public class TestTempFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateTempFile()
|
public void testCreateTempFile() throws Exception
|
||||||
throws Exception
|
|
||||||
{
|
{
|
||||||
File tempFile = TempFile.createTempFile("test", ".txt");
|
File tempFile = TempFile.createTempFile("test", ".txt");
|
||||||
FileOutputStream fos = new FileOutputStream(tempFile);
|
FileOutputStream fos = new FileOutputStream(tempFile);
|
||||||
|
Loading…
Reference in New Issue
Block a user