Skip to content

Commit fcf2a86

Browse files
author
Vikram Agrawal
committed
Fix fileutility unit test
1 parent c38bd6c commit fcf2a86

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

core/src/test/java/org/apache/spark/io/FileUtilitySuite.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@
1818

1919
import org.apache.commons.io.FileUtils;
2020
import org.apache.commons.lang3.RandomUtils;
21-
import org.apache.hadoop.fs.Path;
21+
import org.apache.spark.util.Utils;
2222
import org.junit.After;
2323
import org.junit.Assert;
2424
import org.junit.Before;
2525
import org.junit.Test;
26-
import sun.security.action.GetPropertyAction;
2726

2827
import java.io.File;
2928
import java.io.IOException;
@@ -39,19 +38,14 @@ public class FileUtilitySuite {
3938

4039
@Before
4140
public void setUp() throws IOException {
42-
File tmpLocation = new File(
43-
GetPropertyAction.privilegedGetProperty("java.io.tmpdir"));
44-
Path sourceFolderPath = new Path(tmpLocation.toString(),
41+
sourceFolder = Utils.createTempDir(System.getProperty("java.io.tmpdir"),
4542
"FileUtilTest" + RandomUtils.nextLong());
46-
sourceFolder = new File(sourceFolderPath.toString());
47-
sourceFolder.mkdirs();
4843
destTarLoc = File.createTempFile("dest-tar", ".tar");
4944
destFile = File.createTempFile("dest-file", ".tmp");
5045
}
5146

5247
@After
5348
public void tearDown() {
54-
sourceFolder.delete();
5549
destTarLoc.delete();
5650
destFile.delete();
5751
}

0 commit comments

Comments
 (0)