summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit
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.lfs.server.test/tst/org/eclipse/jgit
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.lfs.server.test/tst/org/eclipse/jgit')
-rw-r--r--org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/DownloadTest.java26
1 files changed, 8 insertions, 18 deletions
diff --git a/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/DownloadTest.java b/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/DownloadTest.java
index d295414496..8d32f9e75a 100644
--- a/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/DownloadTest.java
+++ b/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/DownloadTest.java
@@ -12,6 +12,7 @@ package org.eclipse.jgit.lfs.server.fs;
import static org.apache.http.HttpStatus.SC_NOT_FOUND;
import static org.apache.http.HttpStatus.SC_UNPROCESSABLE_ENTITY;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThrows;
import java.io.IOException;
import java.nio.file.Path;
@@ -22,15 +23,10 @@ import org.apache.http.client.ClientProtocolException;
import org.eclipse.jgit.lfs.lib.AnyLongObjectId;
import org.eclipse.jgit.lfs.test.LongObjectIdTestUtils;
import org.eclipse.jgit.util.FileUtils;
-import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.ExpectedException;
public class DownloadTest extends LfsServerTest {
- @Rule
- public ExpectedException exception = ExpectedException.none();
-
@Test
public void testDownload() throws Exception {
String TEXT = "test";
@@ -49,10 +45,8 @@ public class DownloadTest extends LfsServerTest {
Path f = Paths.get(getTempDirectory().toString(), "download");
String error = String.format(
"Invalid pathInfo: '/%s' does not match '/{SHA-256}'", id);
- exception.expect(RuntimeException.class);
- exception.expectMessage(
- formatErrorMessage(SC_UNPROCESSABLE_ENTITY, error));
- getContent(id, f);
+ assertThrows(formatErrorMessage(SC_UNPROCESSABLE_ENTITY, error),
+ RuntimeException.class, () -> getContent(id, f));
}
@Test
@@ -62,22 +56,18 @@ public class DownloadTest extends LfsServerTest {
String id = putContent(TEXT).name().replace('f', 'z');
Path f = Paths.get(getTempDirectory().toString(), "download");
String error = String.format("Invalid id: %s", id);
- exception.expect(RuntimeException.class);
- exception.expectMessage(
- formatErrorMessage(SC_UNPROCESSABLE_ENTITY, error));
- getContent(id, f);
+ assertThrows(formatErrorMessage(SC_UNPROCESSABLE_ENTITY, error),
+ RuntimeException.class, () -> getContent(id, f));
}
@Test
- public void testDownloadNotFound()
- throws ClientProtocolException, IOException {
+ public void testDownloadNotFound() {
String TEXT = "test";
AnyLongObjectId id = LongObjectIdTestUtils.hash(TEXT);
Path f = Paths.get(getTempDirectory().toString(), "download");
String error = String.format("Object '%s' not found", id.getName());
- exception.expect(RuntimeException.class);
- exception.expectMessage(formatErrorMessage(SC_NOT_FOUND, error));
- getContent(id, f);
+ assertThrows(formatErrorMessage(SC_NOT_FOUND, error),
+ RuntimeException.class, () -> getContent(id, f));
}
@SuppressWarnings("boxing")