Clean up remaining references to and delete MoreAsserts.assertThrows
Deletes non-static-imported uses (intentionally) missed by my initial passes,
then deletes the implementation itself.
PiperOrigin-RevId: 303395844
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/actions/SymlinkTreeActionTest.java b/src/test/java/com/google/devtools/build/lib/analysis/actions/SymlinkTreeActionTest.java
index 24a70d7..b849cf8 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/actions/SymlinkTreeActionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/actions/SymlinkTreeActionTest.java
@@ -13,6 +13,8 @@
// limitations under the License.
package com.google.devtools.build.lib.analysis.actions;
+import static org.junit.Assert.assertThrows;
+
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.devtools.build.lib.actions.ActionEnvironment;
@@ -21,7 +23,6 @@
import com.google.devtools.build.lib.analysis.Runfiles;
import com.google.devtools.build.lib.analysis.util.ActionTester;
import com.google.devtools.build.lib.analysis.util.BuildViewTestCase;
-import com.google.devtools.build.lib.testutil.MoreAsserts;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@@ -122,7 +123,7 @@
public void testNullRunfilesThrows() {
Artifact inputManifest = getBinArtifactWithNoOwner("dir/manifest.in");
Artifact outputManifest = getBinArtifactWithNoOwner("dir/MANIFEST");
- MoreAsserts.assertThrows(
+ assertThrows(
IllegalArgumentException.class,
() ->
new SymlinkTreeAction(
diff --git a/src/test/java/com/google/devtools/build/lib/testutil/MoreAsserts.java b/src/test/java/com/google/devtools/build/lib/testutil/MoreAsserts.java
index 21a4a42..7e11610 100644
--- a/src/test/java/com/google/devtools/build/lib/testutil/MoreAsserts.java
+++ b/src/test/java/com/google/devtools/build/lib/testutil/MoreAsserts.java
@@ -471,56 +471,4 @@
assertWithMessage(events.toString()).that(foundEvents).hasSize(expectedFrequency);
return foundEvents;
}
-
- /*
- * This method will be in JUnit 4.13. Instead of patching Bazel's JUnit jar to contain the
- * <a href="https://github.com/junit-team/junit4/commit/bdb1799">patch</a>, we define it here.
- * Once JUnit 4.13 is released, we will switcher callers to use org.junit.Assert#assertThrows
- * instead. See https://github.com/bazelbuild/bazel/issues/3729.
- */
- public static <T extends Throwable> T assertThrows(
- Class<T> expectedThrowable, ThrowingRunnable runnable) {
- return assertThrows("", expectedThrowable, runnable);
- }
-
- /*
- * This method will be in JUnit 4.13. Instead of patching Bazel's JUnit jar to contain the
- * <a href="https://github.com/junit-team/junit4/commit/bdb1799">patch</a>, we define it here.
- * Once JUnit 4.13 is released, we will switcher callers to use org.junit.Assert#assertThrows
- * instead. See https://github.com/bazelbuild/bazel/issues/3729.
- */
- public static <T extends Throwable> T assertThrows(
- String message, Class<T> expectedThrowable, ThrowingRunnable runnable) {
- try {
- runnable.run();
- } catch (Throwable actualThrown) {
- if (expectedThrowable.isInstance(actualThrown)) {
- @SuppressWarnings("unchecked")
- T retVal = (T) actualThrown;
- return retVal;
- } else {
- throw new AssertionError(
- buildPrefix(message)
- + String.format(
- "expected %s to be thrown, but %s was thrown",
- expectedThrowable.getSimpleName(), actualThrown.getClass().getSimpleName()),
- actualThrown);
- }
- }
- String mismatchMessage =
- buildPrefix(message)
- + String.format(
- "expected %s to be thrown, but nothing was thrown",
- expectedThrowable.getSimpleName());
- throw new AssertionError(mismatchMessage);
- }
-
- private static String buildPrefix(String message) {
- return message != null && message.length() != 0 ? message + ": " : "";
- }
-
- /** A helper interface for {@link #assertThrows}. */
- public interface ThrowingRunnable {
- void run() throws Throwable;
- }
}