Skip to content

Commit a36d824

Browse files
committed
Reuse FileUtils in tests
1 parent 17c9f9e commit a36d824

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/test/java/org/apache/commons/csv/PerformanceTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import java.nio.file.Paths;
3434
import java.util.zip.GZIPInputStream;
3535

36+
import org.apache.commons.io.FileUtils;
3637
import org.apache.commons.io.IOUtils;
3738

3839
/**
@@ -82,7 +83,7 @@ private static class Stats {
8283

8384
private static final String TEST_RESRC = "org/apache/commons/csv/perf/worldcitiespop.txt.gz";
8485

85-
private static final File BIG_FILE = new File(System.getProperty("java.io.tmpdir"), "worldcitiespop.txt");
86+
private static final File BIG_FILE = new File(FileUtils.getTempDirectoryPath(), "worldcitiespop.txt");
8687

8788
private static Reader createReader() throws IOException {
8889
return new InputStreamReader(new FileInputStream(BIG_FILE), StandardCharsets.ISO_8859_1);

src/test/java/org/apache/commons/csv/perf/PerformanceTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.apache.commons.csv.CSVFormat;
3232
import org.apache.commons.csv.CSVParser;
3333
import org.apache.commons.csv.CSVRecord;
34+
import org.apache.commons.io.FileUtils;
3435
import org.apache.commons.io.IOUtils;
3536
import org.junit.jupiter.api.BeforeAll;
3637
import org.junit.jupiter.api.Test;
@@ -45,7 +46,7 @@ public class PerformanceTest {
4546

4647
private static final String TEST_RESRC = "org/apache/commons/csv/perf/worldcitiespop.txt.gz";
4748

48-
private static final File BIG_FILE = new File(System.getProperty("java.io.tmpdir"), "worldcitiespop.txt");
49+
private static final File BIG_FILE = new File(FileUtils.getTempDirectoryPath(), "worldcitiespop.txt");
4950
@BeforeAll
5051
public static void setUpClass() throws FileNotFoundException, IOException {
5152
if (BIG_FILE.exists()) {

0 commit comments

Comments
 (0)