diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2013-10-10 23:01:30 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2013-10-11 00:12:44 +0200 |
commit | b15c617d0f1c098c06b3579d00e8d505047a153d (patch) | |
tree | 03ed14ca1ce5d5f37455dde5bbef6a500e5c270c /org.eclipse.jgit.test | |
parent | 3c2c8b47ff41ced17bc48fbc8cf34de3e1a3bcb2 (diff) | |
download | jgit-b15c617d0f1c098c06b3579d00e8d505047a153d.tar.gz jgit-b15c617d0f1c098c06b3579d00e8d505047a153d.zip |
Describe HEAD if no explicit target was set
Change-Id: I5a5a238709df813ec07278bb3b4f9ea5c85c0883
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/api/DescribeCommandTest.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/DescribeCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/DescribeCommandTest.java index 88f6108926..eb598e80fd 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/DescribeCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/DescribeCommandTest.java @@ -42,16 +42,19 @@ */ package org.eclipse.jgit.api; -import org.eclipse.jgit.api.errors.GitAPIException; -import org.eclipse.jgit.junit.RepositoryTestCase; -import org.eclipse.jgit.lib.ObjectId; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import java.io.File; import java.io.FileWriter; import java.io.IOException; -import static org.junit.Assert.*; +import org.eclipse.jgit.api.errors.GitAPIException; +import org.eclipse.jgit.api.errors.RefNotFoundException; +import org.eclipse.jgit.junit.RepositoryTestCase; +import org.eclipse.jgit.lib.ObjectId; +import org.junit.Test; public class DescribeCommandTest extends RepositoryTestCase { @@ -63,7 +66,7 @@ public class DescribeCommandTest extends RepositoryTestCase { git = new Git(db); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = RefNotFoundException.class) public void noTargetSet() throws Exception { git.describe().call(); } @@ -87,6 +90,9 @@ public class DescribeCommandTest extends RepositoryTestCase { assertNameStartsWith(c4, "3e563c5"); // the value verified with git-describe(1) assertEquals("t2-1-g3e563c5", describe(c4)); + + // test default target + assertEquals("t2-1-g3e563c5", git.describe().call()); } /** |