Automatic cleanup change.
PiperOrigin-RevId: 245944657
diff --git a/src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java b/src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java
index b6f24fd..049ef85 100644
--- a/src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java
+++ b/src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java
@@ -15,7 +15,7 @@
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
-import static org.junit.Assert.fail;
+import static com.google.devtools.build.lib.testutil.MoreAsserts.assertThrows;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -199,14 +199,10 @@
@Test
public void testBinFalseYieldsException() throws Exception {
- try {
- run(createSpawn(getFalseCommand()));
- fail();
- } catch (ExecException e) {
- assertWithMessage("got: " + e.getMessage())
- .that(e.getMessage().startsWith("false failed: error executing command"))
- .isTrue();
- }
+ ExecException e = assertThrows(ExecException.class, () -> run(createSpawn(getFalseCommand())));
+ assertWithMessage("got: " + e.getMessage())
+ .that(e.getMessage().startsWith("false failed: error executing command"))
+ .isTrue();
}
private static String getFalseCommand() {