summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2013-10-08 10:35:39 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2013-10-20 00:13:58 +0200
commit068e2df1ce345f64b30b72471a26d1ce53206b6c (patch)
treedeb20a2d1b4e8ead48c1b7e8875fcc295d3ab6ef /org.eclipse.jgit.test/tst
parent8de3512890480dbed07fa6d46aef722c1ddda442 (diff)
downloadjgit-068e2df1ce345f64b30b72471a26d1ce53206b6c.tar.gz
jgit-068e2df1ce345f64b30b72471a26d1ce53206b6c.zip
Fix failed tests when the tmp directory is a symlink
On Mac OS X /tmp is by default a symbolic link. Change-Id: I0913ee5ee8db5c5918a9e41abbbfe125b6c70783 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryCacheTest.java30
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java5
2 files changed, 19 insertions, 16 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryCacheTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryCacheTest.java
index aad5bfc836..0cab987e6a 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryCacheTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryCacheTest.java
@@ -61,17 +61,17 @@ import org.junit.Test;
public class RepositoryCacheTest extends RepositoryTestCase {
@Test
- public void testNonBareFileKey() {
+ public void testNonBareFileKey() throws IOException {
File gitdir = db.getDirectory();
File parent = gitdir.getParentFile();
File other = new File(parent, "notagit");
- assertEquals(gitdir, FileKey.exact(gitdir, db.getFS()).getFile());
- assertEquals(parent, FileKey.exact(parent, db.getFS()).getFile());
- assertEquals(other, FileKey.exact(other, db.getFS()).getFile());
+ assertEqualsFile(gitdir, FileKey.exact(gitdir, db.getFS()).getFile());
+ assertEqualsFile(parent, FileKey.exact(parent, db.getFS()).getFile());
+ assertEqualsFile(other, FileKey.exact(other, db.getFS()).getFile());
- assertEquals(gitdir, FileKey.lenient(gitdir, db.getFS()).getFile());
- assertEquals(gitdir, FileKey.lenient(parent, db.getFS()).getFile());
- assertEquals(other, FileKey.lenient(other, db.getFS()).getFile());
+ assertEqualsFile(gitdir, FileKey.lenient(gitdir, db.getFS()).getFile());
+ assertEqualsFile(gitdir, FileKey.lenient(parent, db.getFS()).getFile());
+ assertEqualsFile(other, FileKey.lenient(other, db.getFS()).getFile());
}
@Test
@@ -83,10 +83,11 @@ public class RepositoryCacheTest extends RepositoryTestCase {
assertTrue(name.endsWith(".git"));
name = name.substring(0, name.length() - 4);
- assertEquals(gitdir, FileKey.exact(gitdir, db.getFS()).getFile());
+ assertEqualsFile(gitdir, FileKey.exact(gitdir, db.getFS()).getFile());
- assertEquals(gitdir, FileKey.lenient(gitdir, db.getFS()).getFile());
- assertEquals(gitdir, FileKey.lenient(new File(parent, name), db.getFS()).getFile());
+ assertEqualsFile(gitdir, FileKey.lenient(gitdir, db.getFS()).getFile());
+ assertEqualsFile(gitdir,
+ FileKey.lenient(new File(parent, name), db.getFS()).getFile());
}
@Test
@@ -95,12 +96,12 @@ public class RepositoryCacheTest extends RepositoryTestCase {
r = new FileKey(db.getDirectory(), db.getFS()).open(true);
assertNotNull(r);
- assertEquals(db.getDirectory(), r.getDirectory());
+ assertEqualsFile(db.getDirectory(), r.getDirectory());
r.close();
r = new FileKey(db.getDirectory(), db.getFS()).open(false);
assertNotNull(r);
- assertEquals(db.getDirectory(), r.getDirectory());
+ assertEqualsFile(db.getDirectory(), r.getDirectory());
r.close();
}
@@ -116,12 +117,13 @@ public class RepositoryCacheTest extends RepositoryTestCase {
new FileKey(gitdir, db.getFS()).open(true);
fail("incorrectly opened a non existant repository");
} catch (RepositoryNotFoundException e) {
- assertEquals("repository not found: " + gitdir, e.getMessage());
+ assertEquals("repository not found: " + gitdir.getCanonicalPath(),
+ e.getMessage());
}
final Repository o = new FileKey(gitdir, db.getFS()).open(false);
assertNotNull(o);
- assertEquals(gitdir, o.getDirectory());
+ assertEqualsFile(gitdir, o.getDirectory());
assertFalse(gitdir.exists());
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java
index f44f67f845..2b9c107778 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java
@@ -221,8 +221,9 @@ public class SubmoduleWalkTest extends RepositoryTestCase {
Repository subRepo = gen.getRepository();
addRepoToClose(subRepo);
assertNotNull(subRepo);
- assertEquals(modulesGitDir, subRepo.getDirectory());
- assertEquals(new File(db.getWorkTree(), path), subRepo.getWorkTree());
+ assertEqualsFile(modulesGitDir, subRepo.getDirectory());
+ assertEqualsFile(new File(db.getWorkTree(), path),
+ subRepo.getWorkTree());
assertFalse(gen.next());
}