use of com.google.idea.blaze.android.run.runner.FullApkBuildStep in project intellij by bazelbuild.
the class FullApkBuildStepIntegrationTest method build_withBlazeCommandFailure_shouldFail.
@Test
public void build_withBlazeCommandFailure_shouldFail() throws Exception {
// Return a non-zero value to indicate blaze command run failure.
registerApplicationService(ExternalTaskProvider.class, builder -> scopes -> 1337);
// Return fake deploy info proto and mocked deploy info data object.
AndroidDeployInfo fakeProto = AndroidDeployInfo.newBuilder().build();
BlazeAndroidDeployInfo mockDeployInfo = mock(BlazeAndroidDeployInfo.class);
when(mockDeployInfo.getApksToDeploy()).thenReturn(ImmutableList.of());
BlazeApkDeployInfoProtoHelper helper = mock(BlazeApkDeployInfoProtoHelper.class);
when(helper.readDeployInfoProtoForTarget(eq(buildTarget), any(BuildResultHelper.class), any())).thenReturn(fakeProto);
when(helper.extractDeployInfoAndInvalidateManifests(eq(getProject()), eq(new File(getExecRoot())), eq(fakeProto))).thenReturn(mockDeployInfo);
// Perform
FullApkBuildStep buildStep = new FullApkBuildStep(getProject(), buildTarget, ImmutableList.of(), helper);
buildStep.build(context, new DeviceSession(null, null, null));
// Verify
assertThat(context.hasErrors()).isTrue();
assertThat(messageCollector.getMessages()).contains("Blaze build failed. See Blaze Console for details.");
}
Aggregations