mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 12:19:54 +01:00
Javadocs and unit tests, God help me.
This commit is contained in:
@@ -4,9 +4,13 @@ import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class TestUtils {
|
||||
|
||||
private static final AtomicInteger nextTestDir =
|
||||
new AtomicInteger((int) (Math.random() * 1000 * 1000));
|
||||
|
||||
public static void delete(File f) throws IOException {
|
||||
if(f.isDirectory()) for(File child : f.listFiles()) delete(child);
|
||||
f.delete();
|
||||
@@ -19,4 +23,10 @@ public class TestUtils {
|
||||
out.flush();
|
||||
out.close();
|
||||
}
|
||||
|
||||
public static File getTestDirectory() {
|
||||
int name = nextTestDir.getAndIncrement();
|
||||
File testDir = new File("test.tmp/" + name);
|
||||
return testDir;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class SetupWorkerTest extends TestCase {
|
||||
|
||||
private static final int HEADER_SIZE = 1234;
|
||||
|
||||
private final File testDir = new File("test.tmp");
|
||||
private final File testDir = TestUtils.getTestDirectory();
|
||||
private final File jar = new File(testDir, "test.jar");
|
||||
|
||||
@Before
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.junit.Test;
|
||||
|
||||
public class FileUtilsTest extends TestCase {
|
||||
|
||||
private final File testDir = new File("test.tmp");
|
||||
private final File testDir = TestUtils.getTestDirectory();
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.junit.Test;
|
||||
|
||||
public class ZipUtilsTest extends TestCase {
|
||||
|
||||
private final File testDir = new File("test.tmp");
|
||||
private final File testDir = TestUtils.getTestDirectory();
|
||||
|
||||
private final File f1 = new File(testDir, "abc/def/1");
|
||||
private final File f2 = new File(testDir, "abc/def/2");
|
||||
|
||||
Reference in New Issue
Block a user