use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class ModuleDependencyValidatorTest method validateAllModules_assetModuleHasDependency_throws.
@Test
public void validateAllModules_assetModuleHasDependency_throws() throws Exception {
ImmutableList<BundleModule> allModules = ImmutableList.of(module("base", androidManifest(PKG_NAME)), module("asset", androidManifestForAssetModule(PKG_NAME, withOnDemandDelivery(), withUsesSplit("feature"))), module("feature", androidManifest(PKG_NAME, withOnDemandDelivery())));
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new ModuleDependencyValidator().validateAllModules(allModules));
assertThat(exception).hasMessageThat().contains("Module 'asset' cannot depend on module 'feature' because one of them is an asset" + " pack.");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class ModuleDependencyValidatorTest method validateAllModules_installTimeModuleMinSdkSmallerThanBase_fails.
@Test
public void validateAllModules_installTimeModuleMinSdkSmallerThanBase_fails() throws Exception {
ImmutableList<BundleModule> allModules = ImmutableList.of(module("base", androidManifest(PKG_NAME, withMinSdkVersion(20))), module("feature1", androidManifest(PKG_NAME, withMinSdkVersion(19))));
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new ModuleDependencyValidator().validateAllModules(allModules));
assertThat(exception).hasMessageThat().contains("Install-time module 'feature1' has a minSdkVersion(19) different than the" + " minSdkVersion(20) of its dependency 'base'.");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class ModuleDependencyValidatorTest method validateAllModules_referencesUnknownModule_throws.
@Test
public void validateAllModules_referencesUnknownModule_throws() throws Exception {
ImmutableList<BundleModule> allModules = ImmutableList.of(module("base", androidManifest(PKG_NAME)), module("featureA", androidManifest(PKG_NAME, withUsesSplit("unknown"))));
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new ModuleDependencyValidator().validateAllModules(allModules));
assertThat(exception).hasMessageThat().contains("Module 'unknown' is referenced by <uses-split> but does not exist");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class ModuleDependencyValidatorTest method validateAllModules_missingBase_throws.
@Test
public void validateAllModules_missingBase_throws() throws Exception {
ImmutableList<BundleModule> allModules = ImmutableList.of(module("not_base", androidManifest(PKG_NAME, withSplitId("not_base"))));
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new ModuleDependencyValidator().validateAllModules(allModules));
assertThat(exception).hasMessageThat().contains("Mandatory 'base' module is missing");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class ModuleDependencyValidatorTest method validateAllModules_reflexiveDependency_throws.
@Test
public void validateAllModules_reflexiveDependency_throws() throws Exception {
ImmutableList<BundleModule> allModules = ImmutableList.of(module("base", androidManifest(PKG_NAME)), module("feature", androidManifest(PKG_NAME, withUsesSplit("feature"))));
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new ModuleDependencyValidator().validateAllModules(allModules));
assertThat(exception).hasMessageThat().contains("depends on itself");
}
Aggregations