From: mr.gaffo@gmail.com Date: Sun, 13 Sep 2009 18:44:30 GMT Subject: [PATCH JGit 14/19] pulled out some helper functions that will be useful for other tests Message-ID: <1252867475-858-15-git-send-email-mr.gaffo@gmail.com> In-Reply-To: <1252867475-858-14-git-send-email-mr.gaffo@gmail.com> From: mike.gaffney --- .../org/spearce/jgit/lib/ObjectDirectoryTest.java | 21 ++----------------- .../tst/org/spearce/jgit/util/JGitTestUtil.java | 20 ++++++++++++++++++- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ObjectDirectoryTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ObjectDirectoryTest.java index b27f2f8..4fecce7 100644 --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ObjectDirectoryTest.java +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ObjectDirectoryTest.java @@ -4,7 +4,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.UUID; import org.spearce.jgit.util.JGitTestUtil; @@ -19,13 +18,13 @@ @Override protected void setUp() throws Exception { - testDir = new File(new File(System.getProperty("java.io.tmpdir")), UUID.randomUUID().toString()); + testDir = JGitTestUtil.generateTempDirectoryFileObject(); } - + @Override protected void tearDown() throws Exception { if (testDir.exists()){ - deleteDir(testDir); + JGitTestUtil.deleteDir(testDir); } } @@ -93,20 +92,6 @@ public void testUpdateInfoCacheCreatesPacksAndRefsFile() throws Exception { assertEquals(expectedContents, JGitTestUtil.readFileAsString(packsFile)); } - public boolean deleteDir(File dir) { - if (dir.isDirectory()) { - String[] children = dir.list(); - for (int i=0; i