use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class ApexBundleValidatorTest method validateModule_missingPackageFromApexManifest_throws.
@Test
public void validateModule_missingPackageFromApexManifest_throws() throws Exception {
BundleModule apexModule = new BundleModuleBuilder("apexTestModule").setManifest(androidManifest(PKG_NAME)).setApexConfig(APEX_CONFIG).addFile(APEX_MANIFEST_PATH, ApexManifest.getDefaultInstance().toByteArray()).addFile("apex/x86_64.img").addFile("apex/x86.img").addFile("apex/armeabi-v7a.img").addFile("apex/arm64-v8a.img").build();
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new ApexBundleValidator().validateModule(apexModule));
assertThat(exception).hasMessageThat().contains("APEX manifest must have a package name");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class ApexBundleValidatorTest method validateAllModules_multipleApexModules_throws.
@Test
public void validateAllModules_multipleApexModules_throws() throws Exception {
BundleModule apexModule = validApexModule();
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new ApexBundleValidator().validateAllModules(ImmutableList.of(apexModule, apexModule)));
assertThat(exception).hasMessageThat().contains("Multiple APEX modules are not allowed, found 2.");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class ApexBundleValidatorTest method validateModule_untargetedImageFile_throws.
@Test
public void validateModule_untargetedImageFile_throws() throws Exception {
BundleModule apexModule = new BundleModuleBuilder("apexTestModule").setManifest(androidManifest(PKG_NAME)).setApexConfig(APEX_CONFIG).addFile(APEX_MANIFEST_PATH, APEX_MANIFEST).addFile("apex/x86_64.img").addFile("apex/x86.img").addFile("apex/armeabi-v7a.img").addFile("apex/arm64-v8a.img").addFile("apex/x86_64.x86.img").build();
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new ApexBundleValidator().validateModule(apexModule));
assertThat(exception).hasMessageThat().contains("Found APEX image files that are not targeted");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class AssetBundleValidatorTest method validateAllModules_assetOnlyWithInstallTime_throws.
@Test
public void validateAllModules_assetOnlyWithInstallTime_throws() throws Exception {
ImmutableList<BundleModule> allModules = ImmutableList.of(assetOnlyModule("asset", androidManifestForAssetModule(PKG_NAME, withInstallTimeDelivery())));
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new AssetBundleValidator().validateAllModules(allModules));
assertThat(exception).hasMessageThat().contains("Asset-only bundle contains an install-time asset module");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class AssetModuleFilesValidatorTest method moduleWithInvalidEntry_throws.
@Test
public void moduleWithInvalidEntry_throws() throws Exception {
BundleModule module = new BundleModuleBuilder(MODULE_NAME).setManifest(androidManifestForAssetModule(PKG_NAME)).addFile("dex/classes.dex").build();
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new AssetModuleFilesValidator().validateModule(module));
assertThat(exception).hasMessageThat().matches("Invalid entry found in asset pack 'assetmodule': 'dex/classes.dex'.");
}
Aggregations