summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit
diff options
context:
space:
mode:
authorAndrey Loskutov <loskutov@gmx.de>2016-01-03 15:27:01 +0100
committerAndrey Loskutov <loskutov@gmx.de>2016-01-06 17:26:43 -0500
commit24468f09e3fb991ea5a6af293f84c7fe37e78b95 (patch)
tree629aafff1313f73acc7ae34b93e7818e2129ff3c /org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit
parent24cd8e170d377cef87166d43ca25bfa2340755c6 (diff)
downloadjgit-24468f09e3fb991ea5a6af293f84c7fe37e78b95.tar.gz
jgit-24468f09e3fb991ea5a6af293f84c7fe37e78b95.zip
Added CLIText.fatalError(String) API for tests
In different places (Main, TextBuiltin, CLIGitCommand) we report fatal errors and at same time want to check for fatal errors in the tests. Using common API simplifies the error testing and helps to navigate to the actual error check implementation. Change-Id: Iecde79beb33ea595171f168f46b0b10ab2f339bb Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit')
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/DescribeTest.java12
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeTest.java6
2 files changed, 10 insertions, 8 deletions
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/DescribeTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/DescribeTest.java
index a50b243ee8..086e72e9a4 100644
--- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/DescribeTest.java
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/DescribeTest.java
@@ -43,6 +43,7 @@
package org.eclipse.jgit.pgm;
import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -50,6 +51,7 @@ import java.util.Arrays;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.CLIRepositoryTestCase;
+import org.eclipse.jgit.pgm.internal.CLIText;
import org.junit.Before;
import org.junit.Test;
@@ -71,17 +73,15 @@ public class DescribeTest extends CLIRepositoryTestCase {
@Test
public void testNoHead() throws Exception {
- assertArrayEquals(
- new String[] { "fatal: No names found, cannot describe anything." },
- executeUnchecked("git describe"));
+ assertEquals(CLIText.fatalError(CLIText.get().noNamesFound),
+ toString(executeUnchecked("git describe")));
}
@Test
public void testHeadNoTag() throws Exception {
git.commit().setMessage("initial commit").call();
- assertArrayEquals(
- new String[] { "fatal: No names found, cannot describe anything." },
- executeUnchecked("git describe"));
+ assertEquals(CLIText.fatalError(CLIText.get().noNamesFound),
+ toString(executeUnchecked("git describe")));
}
@Test
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeTest.java
index 641e59b04a..47199016d4 100644
--- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeTest.java
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeTest.java
@@ -50,6 +50,7 @@ import java.util.Iterator;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.CLIRepositoryTestCase;
import org.eclipse.jgit.merge.MergeStrategy;
+import org.eclipse.jgit.pgm.internal.CLIText;
import org.eclipse.jgit.revwalk.RevCommit;
import org.junit.Before;
import org.junit.Test;
@@ -194,7 +195,8 @@ public class MergeTest extends CLIRepositoryTestCase {
@Test
public void testNoFastForwardAndSquash() throws Exception {
- assertEquals("fatal: You cannot combine --squash with --no-ff.",
+ assertEquals(
+ CLIText.fatalError(CLIText.get().cannotCombineSquashWithNoff),
executeUnchecked("git merge master --no-ff --squash")[0]);
}
@@ -209,7 +211,7 @@ public class MergeTest extends CLIRepositoryTestCase {
git.add().addFilepattern("file").call();
git.commit().setMessage("commit#2").call();
- assertEquals("fatal: Not possible to fast-forward, aborting.",
+ assertEquals(CLIText.fatalError(CLIText.get().ffNotPossibleAborting),
executeUnchecked("git merge master --ff-only")[0]);
}