Javadocs and unit tests, God help me.

This commit is contained in:
akwizgran
2011-06-27 13:01:31 +01:00
parent d193f23e4c
commit 5281113f24
34 changed files with 169 additions and 54 deletions

View File

@@ -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;
}
}

View File

@@ -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

View File

@@ -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() {

View File

@@ -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");