diff options
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RepositorySetupWorkDirTest.java | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RepositorySetupWorkDirTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RepositorySetupWorkDirTest.java index bc47782ea0..295ef45a79 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RepositorySetupWorkDirTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RepositorySetupWorkDirTest.java @@ -187,16 +187,15 @@ public class RepositorySetupWorkDirTest extends LocalDiskRepositoryTestCase { } } - private static File getFile(String... pathComponents) throws IOException { - String rootPath = new File(new File("target"), "trash").getPath(); + private File getFile(String... pathComponents) throws IOException { + File dir = getTemporaryDirectory(); for (String pathComponent : pathComponents) - rootPath = rootPath + File.separatorChar + pathComponent; - File result = new File(rootPath); - FileUtils.mkdirs(result, true); - return result; + dir = new File(dir, pathComponent); + FileUtils.mkdirs(dir, true); + return dir; } - private static void setBare(File gitDir, boolean bare) throws IOException, + private void setBare(File gitDir, boolean bare) throws IOException, ConfigInvalidException { FileBasedConfig cfg = configFor(gitDir); cfg.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, @@ -204,7 +203,7 @@ public class RepositorySetupWorkDirTest extends LocalDiskRepositoryTestCase { cfg.save(); } - private static void setWorkTree(File gitDir, File workTree) + private void setWorkTree(File gitDir, File workTree) throws IOException, ConfigInvalidException { String path = workTree.getAbsolutePath(); @@ -214,7 +213,7 @@ public class RepositorySetupWorkDirTest extends LocalDiskRepositoryTestCase { cfg.save(); } - private static FileBasedConfig configFor(File gitDir) throws IOException, + private FileBasedConfig configFor(File gitDir) throws IOException, ConfigInvalidException { File configPath = new File(gitDir, Constants.CONFIG); FileBasedConfig cfg = new FileBasedConfig(configPath, FS.DETECTED); @@ -222,14 +221,14 @@ public class RepositorySetupWorkDirTest extends LocalDiskRepositoryTestCase { return cfg; } - private static void assertGitdirPath(Repository repo, String... expected) + private void assertGitdirPath(Repository repo, String... expected) throws IOException { File exp = getFile(expected).getCanonicalFile(); File act = repo.getDirectory().getCanonicalFile(); assertEquals("Wrong Git Directory", exp, act); } - private static void assertWorkdirPath(Repository repo, String... expected) + private void assertWorkdirPath(Repository repo, String... expected) throws IOException { File exp = getFile(expected).getCanonicalFile(); File act = repo.getWorkTree().getCanonicalFile(); |