You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ce...@apache.org on 2014/10/12 22:07:24 UTC
svn commit: r1631250 -
/poi/trunk/src/testcases/org/apache/poi/util/TestTempFile.java
Author: centic
Date: Sun Oct 12 20:07:24 2014
New Revision: 1631250
URL: http://svn.apache.org/r1631250
Log:
Enhance test and coverge for class TempFile
Modified:
poi/trunk/src/testcases/org/apache/poi/util/TestTempFile.java
Modified: poi/trunk/src/testcases/org/apache/poi/util/TestTempFile.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/util/TestTempFile.java?rev=1631250&r1=1631249&r2=1631250&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/util/TestTempFile.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/util/TestTempFile.java Sun Oct 12 20:07:24 2014
@@ -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 TestCa
// 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...
+ }
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org