Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Pearce2013-11-01 15:04:44 +0000
committerShawn Pearce2013-11-02 02:57:47 +0000
commitcc3ec72734fc442499cca60df957c4ef6749c4c3 (patch)
treec252db20424be55e8a7955e9f85f3dea92c0acae /org.eclipse.jgit.test
parente59b3240957e852bfb1c35fa6250ca667743583e (diff)
downloadjgit-cc3ec72734fc442499cca60df957c4ef6749c4c3.tar.gz
jgit-cc3ec72734fc442499cca60df957c4ef6749c4c3.tar.xz
jgit-cc3ec72734fc442499cca60df957c4ef6749c4c3.zip
Remove hardcoded target/trash from test cases
Buck does not create a target directory for the build output, this is Maven specific and the project unit tests should not rely on it. Instead follow the pattern used by org.eclipse.jgit.test which is to create a temporary directory in the system temporary folder, and configure the Maven surefire plugin to use the target directory. Change-Id: Iebe5093332343a90f51080614e083aac0d29c26d
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java9
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java11
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtilTest.java7
3 files changed, 22 insertions, 5 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java
index 17c44dce82..902416bdff 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java
@@ -61,7 +61,14 @@ public class FileSnapshotTest {
private List<File> files = new ArrayList<File>();
- private final File trash = new File(new File("target"), "trash");
+ private File trash;
+
+ @Before
+ public void setUp() throws Exception {
+ trash = File.createTempFile("tmp_", "");
+ trash.delete();
+ assertTrue("mkdir " + trash, trash.mkdir());
+ }
@Before
@After
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java
index 31938b98b3..ee845c5325 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java
@@ -44,6 +44,7 @@ package org.eclipse.jgit.storage.file;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -55,6 +56,7 @@ import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.FileUtils;
import org.eclipse.jgit.util.IO;
import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
public class FileBasedConfigTest {
@@ -73,7 +75,14 @@ public class FileBasedConfigTest {
private static final String CONTENT2 = "[" + USER + "]\n\t" + NAME + " = "
+ BOB + "\n";
- private final File trash = new File(new File("target"), "trash");
+ private File trash;
+
+ @Before
+ public void setUp() throws Exception {
+ trash = File.createTempFile("tmp_", "");
+ trash.delete();
+ assertTrue("mkdir " + trash, trash.mkdir());
+ }
@After
public void tearDown() throws Exception {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtilTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtilTest.java
index df39f2b9d8..7b1627854f 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtilTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtilTest.java
@@ -57,12 +57,13 @@ import org.junit.Before;
import org.junit.Test;
public class FileUtilTest {
-
- private final File trash = new File(new File("target"), "trash");
+ private File trash;
@Before
public void setUp() throws Exception {
- assertTrue(trash.mkdirs());
+ trash = File.createTempFile("tmp_", "");
+ trash.delete();
+ assertTrue("mkdir " + trash, trash.mkdir());
}
@After

Back to the top