use of com.google.idea.blaze.android.run.runner.ApkBuildStep in project intellij by bazelbuild.
the class BlazeAndroidBinaryApplicationIdProviderTest method getApplicationId.
@Test
public void getApplicationId() throws Exception {
ParsedManifest manifest = new ParsedManifest("package.name", ImmutableList.of(), null);
BlazeAndroidDeployInfo deployInfo = new BlazeAndroidDeployInfo(manifest, null, ImmutableList.of());
ApkBuildStep mockBuildStep = mock(ApkBuildStep.class);
when(mockBuildStep.getDeployInfo()).thenReturn(deployInfo);
BlazeAndroidBinaryApplicationIdProvider provider = new BlazeAndroidBinaryApplicationIdProvider(mockBuildStep);
assertThat(provider.getPackageName()).isEqualTo("package.name");
}
use of com.google.idea.blaze.android.run.runner.ApkBuildStep in project intellij by bazelbuild.
the class BlazeAndroidBinaryApplicationIdProviderTest method getApplicationId_noPackageNameInMergedManifest.
@Test
public void getApplicationId_noPackageNameInMergedManifest() throws Exception {
ParsedManifest manifest = new ParsedManifest(null, ImmutableList.of(), null);
BlazeAndroidDeployInfo deployInfo = new BlazeAndroidDeployInfo(manifest, null, ImmutableList.of());
ApkBuildStep mockBuildStep = mock(ApkBuildStep.class);
when(mockBuildStep.getDeployInfo()).thenReturn(deployInfo);
BlazeAndroidBinaryApplicationIdProvider provider = new BlazeAndroidBinaryApplicationIdProvider(mockBuildStep);
try {
provider.getPackageName();
fail();
} catch (ApkProvisionException ex) {
// An exception should be thrown if the package name is not available because it's a
// serious error and should not fail silently.
}
}
use of com.google.idea.blaze.android.run.runner.ApkBuildStep in project intellij by bazelbuild.
the class BlazeAndroidTestApplicationIdProviderTest method getPackageName.
@Test
public void getPackageName() throws Exception {
BlazeAndroidDeployInfo deployInfo = new BlazeAndroidDeployInfo(stubManifest("test.package.name"), stubManifest("package.name"), ImmutableList.of());
ApkBuildStep mockBuildStep = mock(ApkBuildStep.class);
when(mockBuildStep.getDeployInfo()).thenReturn(deployInfo);
BlazeAndroidTestApplicationIdProvider provider = new BlazeAndroidTestApplicationIdProvider(mockBuildStep);
assertThat(provider.getPackageName()).isEqualTo("package.name");
}
Aggregations