Automatic cleanup change.

PiperOrigin-RevId: 246137705
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/LocationFunctionTest.java b/src/test/java/com/google/devtools/build/lib/analysis/LocationFunctionTest.java
index 258095f..bdc969c 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/LocationFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/LocationFunctionTest.java
@@ -15,7 +15,7 @@
 package com.google.devtools.build.lib.analysis;
 
 import static com.google.common.truth.Truth.assertThat;
-import static org.junit.Assert.fail;
+import static com.google.devtools.build.lib.testutil.MoreAsserts.assertThrows;
 
 import com.google.common.base.Suppliers;
 import com.google.common.collect.ImmutableMap;
@@ -59,57 +59,49 @@
   @Test
   public void noSuchLabel() throws Exception {
     LocationFunction func = new LocationFunctionBuilder("//foo", false).build();
-    try {
-      func.apply("//bar", ImmutableMap.of());
-      fail();
-    } catch (IllegalStateException expected) {
-      assertThat(expected).hasMessageThat()
-          .isEqualTo(
-              "label '//bar:bar' in $(location) expression is not a declared prerequisite of this "
-              + "rule");
-    }
+    IllegalStateException expected =
+        assertThrows(IllegalStateException.class, () -> func.apply("//bar", ImmutableMap.of()));
+    assertThat(expected)
+        .hasMessageThat()
+        .isEqualTo(
+            "label '//bar:bar' in $(location) expression is not a declared prerequisite of this "
+                + "rule");
   }
 
   @Test
   public void emptyList() throws Exception {
     LocationFunction func = new LocationFunctionBuilder("//foo", false).add("//foo").build();
-    try {
-      func.apply("//foo", ImmutableMap.of());
-      fail();
-    } catch (IllegalStateException expected) {
-      assertThat(expected).hasMessageThat()
-          .isEqualTo("label '//foo:foo' in $(location) expression expands to no files");
-    }
+    IllegalStateException expected =
+        assertThrows(IllegalStateException.class, () -> func.apply("//foo", ImmutableMap.of()));
+    assertThat(expected)
+        .hasMessageThat()
+        .isEqualTo("label '//foo:foo' in $(location) expression expands to no files");
   }
 
   @Test
   public void tooMany() throws Exception {
     LocationFunction func =
         new LocationFunctionBuilder("//foo", false).add("//foo", "/exec/1", "/exec/2").build();
-    try {
-      func.apply("//foo", ImmutableMap.of());
-      fail();
-    } catch (IllegalStateException expected) {
-      assertThat(expected).hasMessageThat()
-          .isEqualTo(
-              "label '//foo:foo' in $(location) expression expands to more than one file, "
-              + "please use $(locations //foo:foo) instead.  Files (at most 5 shown) are: "
-              + "[./1, ./2]");
-    }
+    IllegalStateException expected =
+        assertThrows(IllegalStateException.class, () -> func.apply("//foo", ImmutableMap.of()));
+    assertThat(expected)
+        .hasMessageThat()
+        .isEqualTo(
+            "label '//foo:foo' in $(location) expression expands to more than one file, "
+                + "please use $(locations //foo:foo) instead.  Files (at most 5 shown) are: "
+                + "[./1, ./2]");
   }
 
   @Test
   public void noSuchLabelMultiple() throws Exception {
     LocationFunction func = new LocationFunctionBuilder("//foo", true).build();
-    try {
-      func.apply("//bar", ImmutableMap.of());
-      fail();
-    } catch (IllegalStateException expected) {
-      assertThat(expected).hasMessageThat()
-          .isEqualTo(
-              "label '//bar:bar' in $(locations) expression is not a declared prerequisite of this "
-              + "rule");
-    }
+    IllegalStateException expected =
+        assertThrows(IllegalStateException.class, () -> func.apply("//bar", ImmutableMap.of()));
+    assertThat(expected)
+        .hasMessageThat()
+        .isEqualTo(
+            "label '//bar:bar' in $(locations) expression is not a declared prerequisite of this "
+                + "rule");
   }
 
   @Test