summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.http.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.http.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.http.test')
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java26
1 files changed, 11 insertions, 15 deletions
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
index 9a7c0776ad..51a7a8ddc1 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
@@ -18,6 +18,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -88,18 +89,12 @@ import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;
import org.eclipse.jgit.transport.http.HttpConnectionFactory;
import org.eclipse.jgit.util.HttpSupport;
import org.eclipse.jgit.util.SystemReader;
-import org.hamcrest.Matchers;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.ExpectedException;
public class SmartClientSmartServerTest extends AllFactoriesHttpTestCase {
private static final String HDR_TRANSFER_ENCODING = "Transfer-Encoding";
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
private AdvertiseRefsHook advertiseRefsHook;
private Repository remoteRepository;
@@ -462,11 +457,12 @@ public class SmartClientSmartServerTest extends AllFactoriesHttpTestCase {
try (Repository dst = createBareRepository();
Transport t = Transport.open(dst, remoteURI)) {
assertFalse(dst.getObjectDatabase().has(A_txt));
- thrown.expect(TransportException.class);
- thrown.expectMessage(Matchers.containsString(
+ Exception e = assertThrows(TransportException.class,
+ () -> t.fetch(NullProgressMonitor.INSTANCE,
+ Collections.singletonList(
+ new RefSpec(unreachableCommit.name()))));
+ assertTrue(e.getMessage().contains(
"want " + unreachableCommit.name() + " not valid"));
- t.fetch(NullProgressMonitor.INSTANCE, Collections
- .singletonList(new RefSpec(unreachableCommit.name())));
}
}
@@ -484,11 +480,11 @@ public class SmartClientSmartServerTest extends AllFactoriesHttpTestCase {
try (Repository dst = createBareRepository();
Transport t = Transport.open(dst, remoteURI)) {
assertFalse(dst.getObjectDatabase().has(A_txt));
- thrown.expect(TransportException.class);
- thrown.expectMessage(Matchers.containsString(
- "want " + A.name() + " not valid"));
- t.fetch(NullProgressMonitor.INSTANCE, Collections
- .singletonList(new RefSpec(A.name())));
+ Exception e = assertThrows(TransportException.class,
+ () -> t.fetch(NullProgressMonitor.INSTANCE,
+ Collections.singletonList(new RefSpec(A.name()))));
+ assertTrue(
+ e.getMessage().contains("want " + A.name() + " not valid"));
}
}