expectThrows has been renamed to assertThrows
More information: https://github.com/junit-team/junit5/issues/531
PiperOrigin-RevId: 186900384
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java
index 0524bb3..83d7e93 100644
--- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java
@@ -15,7 +15,7 @@
package com.google.devtools.build.lib.skylark;
import static com.google.common.truth.Truth.assertThat;
-import static com.google.devtools.build.lib.testutil.MoreAsserts.expectThrows;
+import static com.google.devtools.build.lib.testutil.MoreAsserts.assertThrows;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
@@ -1599,9 +1599,8 @@
"my_rule(name = 'main', exe = ':tool.sh')"
);
- AssertionError expected = expectThrows(
- AssertionError.class,
- () -> createRuleContext("//third_party/foo:main"));
+ AssertionError expected =
+ assertThrows(AssertionError.class, () -> createRuleContext("//third_party/foo:main"));
assertThat(expected).hasMessageThat()
.contains("cfg parameter is mandatory when executable=True is provided.");
}
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleImplementationFunctionsTest.java b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleImplementationFunctionsTest.java
index 6d78fe5..edb8d48 100644
--- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleImplementationFunctionsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleImplementationFunctionsTest.java
@@ -16,7 +16,7 @@
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
-import static com.google.devtools.build.lib.testutil.MoreAsserts.expectThrows;
+import static com.google.devtools.build.lib.testutil.MoreAsserts.assertThrows;
import static org.junit.Assert.fail;
import com.google.common.collect.ImmutableList;
@@ -2088,8 +2088,7 @@
"main_rule(name='main')");
AssertionError expected =
- expectThrows(AssertionError.class,
- () -> getConfiguredTarget("//test:main"));
+ assertThrows(AssertionError.class, () -> getConfiguredTarget("//test:main"));
assertThat(expected).hasMessageThat()
.contains("invalid configuration fragment name 'notarealfragment'");
@@ -2114,8 +2113,7 @@
"main_rule(name='main')");
AssertionError expected =
- expectThrows(AssertionError.class,
- () -> getConfiguredTarget("//test:main"));
+ assertThrows(AssertionError.class, () -> getConfiguredTarget("//test:main"));
assertThat(expected).hasMessageThat()
.contains("has to declare 'apple' as a required fragment in target configuration");
@@ -2140,8 +2138,7 @@
"main_rule(name='main')");
AssertionError expected =
- expectThrows(AssertionError.class,
- () -> getConfiguredTarget("//test:main"));
+ assertThrows(AssertionError.class, () -> getConfiguredTarget("//test:main"));
assertThat(expected).hasMessageThat()
.contains("invalid configuration field name 'notarealfield' on fragment 'apple'");
@@ -2167,8 +2164,7 @@
"main_rule(name='main')");
AssertionError expected =
- expectThrows(AssertionError.class,
- () -> getConfiguredTarget("//test:main"));
+ assertThrows(AssertionError.class, () -> getConfiguredTarget("//test:main"));
assertThat(expected).hasMessageThat()
.contains("When an attribute value is a function, "
@@ -2195,8 +2191,7 @@
"main_rule(name='main')");
AssertionError expected =
- expectThrows(AssertionError.class,
- () -> getConfiguredTarget("//test:main"));
+ assertThrows(AssertionError.class, () -> getConfiguredTarget("//test:main"));
assertThat(expected).hasMessageThat()
.contains("argument 'default' has type 'SkylarkLateBoundDefault', but should be 'int'");