aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/util
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2014-10-12 20:07:24 +0000
committerDominik Stadler <centic@apache.org>2014-10-12 20:07:24 +0000
commit312317f8c4f3ad4c2e05f96e389697c73fc04f87 (patch)
tree619672789857efba7ed17fffbd51c8d13df4d23d /src/testcases/org/apache/poi/util
parent74630e3dcb5ea358a20e2d9bb40a95c607a70278 (diff)
downloadpoi-312317f8c4f3ad4c2e05f96e389697c73fc04f87.tar.gz
poi-312317f8c4f3ad4c2e05f96e389697c73fc04f87.zip
Enhance test and coverge for class TempFile
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1631250 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/util')
-rw-r--r--src/testcases/org/apache/poi/util/TestTempFile.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/testcases/org/apache/poi/util/TestTempFile.java b/src/testcases/org/apache/poi/util/TestTempFile.java
index 8f0e8a7b82..c41032fe2d 100644
--- a/src/testcases/org/apache/poi/util/TestTempFile.java
+++ b/src/testcases/org/apache/poi/util/TestTempFile.java
@@ -20,6 +20,7 @@ import junit.framework.TestCase;
import java.io.File;
import java.io.FileWriter;
+import java.io.IOException;
/**
* @author Glen Stampoultzis
@@ -39,4 +40,28 @@ public class TestTempFile extends TestCase {
// Can't think of a good way to check whether a file is actually deleted since it would require the VM to stop.
}
-} \ No newline at end of file
+
+ public void testConstructor() {
+ // can currently be constructed...
+ new TempFile();
+ }
+
+ public void testSetTempFileCreationStrategy() throws IOException {
+ TempFile.setTempFileCreationStrategy(new TempFile.DefaultTempFileCreationStrategy());
+
+ File file1 = TempFile.createTempFile("TestTempFile", ".tst");
+ File file2 = TempFile.createTempFile("TestTempFile", ".tst");
+ assertFalse(file1.equals(file2));
+ assertNotNull(file2);
+ assertTrue(file2.delete());
+ assertNotNull(file1);
+ assertTrue(file1.delete());
+
+ try {
+ TempFile.setTempFileCreationStrategy(null);
+ fail("Expecting an exception here");
+ } catch (IllegalArgumentException e) {
+ // expecting an exception here...
+ }
+ }
+}