use of com.google.idea.blaze.base.command.buildresult.ParsedBepOutput in project intellij by bazelbuild.
the class FullApkBuildStepIntegrationTest method build_withNullExecRoot_shouldFail.
@Test
public void build_withNullExecRoot_shouldFail() throws Exception {
// Return null execroot
when(mockBuildResultHelper.getBuildOutput()).thenReturn(new ParsedBepOutput(null, null, null, null, 0, BuildResult.SUCCESS));
// 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, blazeFlags, helper);
buildStep.build(context, new DeviceSession(null, null, null));
// Verify
assertThat(context.hasErrors()).isTrue();
assertThat(messageCollector.getMessages()).contains("Could not locate execroot!");
}
use of com.google.idea.blaze.base.command.buildresult.ParsedBepOutput in project intellij by bazelbuild.
the class FullApkBuildStepIntegrationTest method setupBuildResultHelperProvider.
/**
* Setup build result helper to return BEP output with test execroot by default.
*/
@Before
public void setupBuildResultHelperProvider() throws GetArtifactsException {
mockBuildResultHelper = mock(BuildResultHelper.class);
when(mockBuildResultHelper.getBuildOutput()).thenReturn(new ParsedBepOutput(null, getExecRoot(), null, null, 0, BuildResult.SUCCESS));
registerExtension(BuildResultHelperProvider.EP_NAME, new BuildResultHelperProvider() {
@Override
public Optional<BuildResultHelper> doCreate(Project project, BlazeInfo blazeInfo) {
return Optional.of(mockBuildResultHelper);
}
@Override
public Optional<BuildResultHelper> doCreateForLocalBuild(Project project) {
return Optional.of(mockBuildResultHelper);
}
});
}
Aggregations