use of com.google.idea.blaze.android.manifest.ManifestParser.ParsedManifest in project intellij by bazelbuild.
the class BlazeApkDeployInfoProtoHelperTest method readDeployInfoForNormalBuild_withTestTargetManifest.
@Test
public void readDeployInfoForNormalBuild_withTestTargetManifest() throws Exception {
// setup
AndroidDeployInfo deployInfoProto = AndroidDeployInfo.newBuilder().setMergedManifest(makeArtifact("path/to/manifest")).addAdditionalMergedManifests(makeArtifact("path/to/testtarget/manifest")).addApksToDeploy(makeArtifact("path/to/apk")).addApksToDeploy(makeArtifact("path/to/testtarget/apk")).build();
File mainApk = new File("execution_root/path/to/apk");
File testApk = new File("execution_root/path/to/testtarget/apk");
File mainManifest = new File("execution_root/path/to/manifest");
File testTargetManifest = new File("execution_root/path/to/testtarget/manifest");
ParsedManifest parsedMainManifest = new ParsedManifest("main", null, null);
ParsedManifest parsedTestManifest = new ParsedManifest("testtarget", null, null);
when(mockParsedManifestService.getParsedManifest(mainManifest)).thenReturn(parsedMainManifest);
when(mockParsedManifestService.getParsedManifest(testTargetManifest)).thenReturn(parsedTestManifest);
// perform
BlazeAndroidDeployInfo deployInfo = new BlazeApkDeployInfoProtoHelper().extractDeployInfoAndInvalidateManifests(getProject(), new File("execution_root"), deployInfoProto);
// verify
assertThat(deployInfo.getApksToDeploy()).containsExactly(mainApk, testApk).inOrder();
assertThat(deployInfo.getMergedManifest()).isEqualTo(parsedMainManifest);
assertThat(deployInfo.getTestTargetMergedManifest()).isEqualTo(parsedTestManifest);
ArgumentCaptor<File> expectedArgs = ArgumentCaptor.forClass(File.class);
verify(mockParsedManifestService, times(2)).invalidateCachedManifest(expectedArgs.capture());
assertThat(expectedArgs.getAllValues()).containsExactly(mainManifest, testTargetManifest).inOrder();
}
Aggregations