aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-testing-harness
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2015-06-04 10:54:42 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2015-06-04 10:57:30 +0200
commit3862494e47e0927a62ed2cb5f0f623c2cba664c3 (patch)
treefa47c049dd8a10932a09c62985b77b4b5b6c6305 /sonar-testing-harness
parent6b8860f23102834df92be32f04d9f29a0fa3cd47 (diff)
downloadsonarqube-3862494e47e0927a62ed2cb5f0f623c2cba664c3.tar.gz
sonarqube-3862494e47e0927a62ed2cb5f0f623c2cba664c3.zip
Fix quality flaws
Diffstat (limited to 'sonar-testing-harness')
-rw-r--r--sonar-testing-harness/src/main/java/org/sonar/test/TestUtils.java12
1 files changed, 4 insertions, 8 deletions
diff --git a/sonar-testing-harness/src/main/java/org/sonar/test/TestUtils.java b/sonar-testing-harness/src/main/java/org/sonar/test/TestUtils.java
index 31e9e24cfef..ba4728675ab 100644
--- a/sonar-testing-harness/src/main/java/org/sonar/test/TestUtils.java
+++ b/sonar-testing-harness/src/main/java/org/sonar/test/TestUtils.java
@@ -19,13 +19,13 @@
*/
package org.sonar.test;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
-
import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
import java.net.URL;
+import java.nio.file.Files;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
/**
* Utilities for unit tests
@@ -93,11 +93,7 @@ public final class TestUtils {
public static File newTempDir(String prefix) {
try {
- // Technique to create a temp directory from a temp file
- File f = File.createTempFile(prefix, "");
- f.delete();
- f.mkdir();
- return f;
+ return Files.createTempDirectory(prefix).toFile();
} catch (Exception e) {
throw new IllegalStateException("Fail to create temp dir", e);
}