summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit
diff options
context:
space:
mode:
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")