aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm.test
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2020-01-22 00:48:24 +0100
committerDavid Pursehouse <david.pursehouse@gmail.com>2020-01-24 15:46:08 +0900
commit8ada9048c5add754c3b34851b1bd501ce28b3321 (patch)
tree9585b6b6a4bb3459039cda84bacac1311b2ebc7a /org.eclipse.jgit.pgm.test
parentb5cabfbff207c30cff0b082d0aed553b5ae8a785 (diff)
downloadjgit-8ada9048c5add754c3b34851b1bd501ce28b3321.tar.gz
jgit-8ada9048c5add754c3b34851b1bd501ce28b3321.zip
Replace ExpectedException which was deprecated in junit 4.13
Change-Id: I64b0c057dd0a12aef2f3d56fa0c8a10e3b23fffd Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm.test')
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/BlameTest.java26
1 files changed, 9 insertions, 17 deletions
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/BlameTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/BlameTest.java
index 006039bdca..ea30433583 100644
--- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/BlameTest.java
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/BlameTest.java
@@ -9,6 +9,7 @@
*/
package org.eclipse.jgit.pgm;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import org.eclipse.jgit.api.Git;
@@ -17,24 +18,18 @@ import org.eclipse.jgit.lib.CLIRepositoryTestCase;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.revwalk.RevCommit;
-import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.ExpectedException;
public class BlameTest extends CLIRepositoryTestCase {
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
@Test
public void testBlameNoHead() throws Exception {
try (Git git = new Git(db)) {
writeTrashFile("inIndex.txt", "index");
git.add().addFilepattern("inIndex.txt").call();
}
- thrown.expect(Die.class);
- thrown.expectMessage("no such ref: HEAD");
- execute("git blame inIndex.txt");
+ assertThrows("no such ref: HEAD", Die.class,
+ () -> execute("git blame inIndex.txt"));
}
@Test
@@ -68,9 +63,8 @@ public class BlameTest extends CLIRepositoryTestCase {
git.commit().setMessage("initial commit").call();
}
writeTrashFile("onlyInWorkingTree.txt", "not in repo");
- thrown.expect(Die.class);
- thrown.expectMessage("no such path 'onlyInWorkingTree.txt' in HEAD");
- execute("git blame onlyInWorkingTree.txt");
+ assertThrows("no such path 'onlyInWorkingTree.txt' in HEAD", Die.class,
+ () -> execute("git blame onlyInWorkingTree.txt"));
}
@Test
@@ -78,9 +72,8 @@ public class BlameTest extends CLIRepositoryTestCase {
try (Git git = new Git(db)) {
git.commit().setMessage("initial commit").call();
}
- thrown.expect(Die.class);
- thrown.expectMessage("no such path 'does_not_exist.txt' in HEAD");
- execute("git blame does_not_exist.txt");
+ assertThrows("no such path 'does_not_exist.txt' in HEAD", Die.class,
+ () -> execute("git blame does_not_exist.txt"));
}
@Test
@@ -88,9 +81,8 @@ public class BlameTest extends CLIRepositoryTestCase {
try (Git git = new Git(db)) {
git.commit().setMessage("initial commit").call();
}
- thrown.expect(Die.class);
- thrown.expectMessage("no such path 'sub/does_not_exist.txt' in HEAD");
- execute("git blame sub/does_not_exist.txt");
+ assertThrows("no such path 'sub/does_not_exist.txt' in HEAD", Die.class,
+ () -> execute("git blame sub/does_not_exist.txt"));
}
@Test