<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <argLine>-Xmx256m -Dfile.encoding=UTF-8</argLine>
+ <argLine>-Xmx256m -Dfile.encoding=UTF-8 -Djava.io.tmpdir=${project.build.directory}</argLine>
</configuration>
</plugin>
</plugins>
import org.junit.Test;
public class FSJava7Test {
-
- private final File trash = new File(new File("target"), "trash");
+ private File trash;
@Before
public void setUp() throws Exception {
- FileUtils.delete(trash, FileUtils.RECURSIVE | FileUtils.RETRY | FileUtils.SKIP_MISSING);
- assertTrue(trash.mkdirs());
+ trash = File.createTempFile("tmp_", "");
+ trash.delete();
+ assertTrue("mkdir " + trash, trash.mkdir());
}
@After
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
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;
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 {
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 {
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