]> source.dussan.org Git - poi.git/commitdiff
Remove the created temporary directory after the test again
authorDominik Stadler <centic@apache.org>
Sun, 29 May 2016 21:33:33 +0000 (21:33 +0000)
committerDominik Stadler <centic@apache.org>
Sun, 29 May 2016 21:33:33 +0000 (21:33 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1746060 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/util/TestTempFile.java

index 7ad40ed47cd86b47510dd0ba7f49ec0a585cd94b..38663480ee20d0e6314654ce74bda91765c67b0e 100644 (file)
@@ -26,6 +26,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.Arrays;
 
+import org.apache.poi.poifs.dev.TestPOIFSDump;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -47,7 +48,7 @@ public class TestTempFile {
     }
 
     @After
-    public void tearDown() {
+    public void tearDown() throws IOException {
         String[] files = tempDir.list();
         // can have the "poifiles" subdir
         if(files.length == 1) {
@@ -58,6 +59,9 @@ public class TestTempFile {
             assertEquals("Had: " + Arrays.toString(files), 0, files.length);
         }
 
+        // remove the directory after the tests
+        TestPOIFSDump.deleteDirectory(tempDir);
+
         if(previousTempDir == null) {
             System.clearProperty(TempFile.JAVA_IO_TMPDIR);
         } else {
@@ -66,8 +70,7 @@ public class TestTempFile {
     }
 
     @Test
-    public void testCreateTempFile()
-            throws Exception
+    public void testCreateTempFile() throws Exception
     {
         File tempFile = TempFile.createTempFile("test", ".txt");
         FileOutputStream fos = new FileOutputStream(tempFile);