diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2020-01-21 17:27:59 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2020-01-22 18:16:14 +0100 |
commit | c02a57f4fac277385789eb953138e77e713cb892 (patch) | |
tree | c6a7560013f128a75a85b1b8f49883af6f6ac189 /org.eclipse.jgit.test | |
parent | 926d392ea57831336e034475c5ab07c107a12562 (diff) | |
download | jgit-c02a57f4fac277385789eb953138e77e713cb892.tar.gz jgit-c02a57f4fac277385789eb953138e77e713cb892.zip |
Update to Orbit I20200120214610 and JUnit to 4.13
Since version 4.13 JUnit has an assertThrows method. Remove the
implementation in MoreAsserts and use the one from JUnit.
CQ: 21439
Change-Id: I086baa94aa3069cebe87c4cbf91ed1534523c6cb
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test')
5 files changed, 8 insertions, 54 deletions
diff --git a/org.eclipse.jgit.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.test/META-INF/MANIFEST.MF index d8f6bcfe28..509ef0b05c 100644 --- a/org.eclipse.jgit.test/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.test/META-INF/MANIFEST.MF @@ -70,11 +70,11 @@ Import-Package: com.googlecode.javaewah;version="[1.1.6,2.0.0)", org.eclipse.jgit.util;version="[5.7.0,5.8.0)", org.eclipse.jgit.util.io;version="[5.7.0,5.8.0)", org.eclipse.jgit.util.sha1;version="[5.7.0,5.8.0)", - org.junit;version="[4.12,5.0.0)", - org.junit.experimental.theories;version="[4.12,5.0.0)", - org.junit.rules;version="[4.12,5.0.0)", - org.junit.runner;version="[4.12,5.0.0)", - org.junit.runners;version="[4.12,5.0.0)", + org.junit;version="[4.13,5.0.0)", + org.junit.experimental.theories;version="[4.13,5.0.0)", + org.junit.rules;version="[4.13,5.0.0)", + org.junit.runner;version="[4.13,5.0.0)", + org.junit.runners;version="[4.13,5.0.0)", org.mockito;version="[2.23.0,3.0.0)", org.mockito.invocation;version="[2.23.0,3.0.0)", org.mockito.junit;version="[2.23.0,3.0.0)", diff --git a/org.eclipse.jgit.test/src/org/eclipse/jgit/lib/MoreAsserts.java b/org.eclipse.jgit.test/src/org/eclipse/jgit/lib/MoreAsserts.java deleted file mode 100644 index cd0a6f1061..0000000000 --- a/org.eclipse.jgit.test/src/org/eclipse/jgit/lib/MoreAsserts.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2019, Google LLC and others - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Distribution License v. 1.0 which is available at - * https://www.eclipse.org/org/documents/edl-v10.php. - * - * SPDX-License-Identifier: BSD-3-Clause - */ -package org.eclipse.jgit.lib; - -/** Assertion methods. */ -public class MoreAsserts { - /** - * Simple version of assertThrows that will be introduced in JUnit 4.13. - * - * @param expected - * Expected throwable class - * @param r - * Runnable that is expected to throw an exception. - * @return The thrown exception. - */ - public static <T extends Throwable> T assertThrows(Class<T> expected, - ThrowingRunnable r) { - try { - r.run(); - } catch (Throwable actual) { - if (expected.isAssignableFrom(actual.getClass())) { - @SuppressWarnings("unchecked") - T toReturn = (T) actual; - return toReturn; - } - throw new AssertionError("Expected " + expected.getSimpleName() - + ", but got " + actual.getClass().getSimpleName(), actual); - } - throw new AssertionError( - "Expected " + expected.getSimpleName() + " to be thrown"); - } - - public interface ThrowingRunnable { - void run() throws Throwable; - } - - private MoreAsserts() { - } -} diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java index f73dfedaec..65c48ad895 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java @@ -13,7 +13,6 @@ package org.eclipse.jgit.internal.storage.reftable; import static org.eclipse.jgit.lib.Constants.HEAD; import static org.eclipse.jgit.lib.Constants.OBJECT_ID_LENGTH; import static org.eclipse.jgit.lib.Constants.R_HEADS; -import static org.eclipse.jgit.lib.MoreAsserts.assertThrows; import static org.eclipse.jgit.lib.Ref.Storage.NEW; import static org.eclipse.jgit.lib.Ref.Storage.PACKED; import static org.hamcrest.CoreMatchers.containsString; @@ -23,6 +22,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackReachabilityTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackReachabilityTest.java index 2c9712c996..d113eabd89 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackReachabilityTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackReachabilityTest.java @@ -9,10 +9,10 @@ */ package org.eclipse.jgit.transport; -import static org.eclipse.jgit.lib.MoreAsserts.assertThrows; import static org.hamcrest.Matchers.containsString; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import java.util.Collections; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java index 108e5edb78..052cb14bf5 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java @@ -1,6 +1,5 @@ package org.eclipse.jgit.transport; -import static org.eclipse.jgit.lib.MoreAsserts.assertThrows; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.hasItems; @@ -10,6 +9,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import java.io.ByteArrayInputStream; |