Skip to content

Commit

Permalink
Fix error-prone warning on AndroidBinaryTest.
Browse files Browse the repository at this point in the history
The test was not incorrect before, however it was unfortunate that we were both
expecting an AssertionError and also throwing an AssertionError to signal that
no AssertionError was thrown.

RELNOTES: None
PiperOrigin-RevId: 169721076
  • Loading branch information
aj-michael authored and katre committed Sep 25, 2017
1 parent ed4405d commit a9573d8
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import static com.google.devtools.build.lib.actions.util.ActionsTestUtil.getFirstArtifactEndingWith;
import static org.junit.Assert.fail;
import static com.google.devtools.build.lib.testutil.MoreAsserts.expectThrows;

import com.google.common.base.Joiner;
import com.google.common.base.Predicate;
Expand Down Expand Up @@ -106,12 +106,12 @@ public void testAndroidSplitTransitionWithInvalidCpu() throws Exception {
// --android_cpu with --android_crosstool_top also triggers the split transition.
useConfiguration("--fat_apk_cpu=doesnotexist",
"--android_crosstool_top=//android/crosstool:everything");
try {
getConfiguredTarget("//test/skylark:test");
fail("Expected an error that no toolchain matched.");
} catch (AssertionError e) {
assertThat(e.getMessage()).contains("No toolchain found for cpu 'doesnotexist'");
}

AssertionError noToolchainError =
expectThrows(AssertionError.class, () -> getConfiguredTarget("//test/skylark:test"));
assertThat(noToolchainError)
.hasMessageThat()
.contains("No toolchain found for cpu 'doesnotexist'");
}

@Test
Expand Down

0 comments on commit a9573d8

Please sign in to comment.