use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class BundleConfigValidatorTest method masterResources_undefinedResourceId_throws.
@Test
public void masterResources_undefinedResourceId_throws() throws Exception {
ResourceTable resourceTable = new ResourceTableBuilder().addPackage("com.test.app").addStringResource("label", "Hello World").build();
int nonExistentResourceId = ResourcesUtils.entries(resourceTable).findFirst().get().getResourceId().getFullResourceId() + 1;
AppBundle appBundle = createAppBundleBuilder(BundleConfigBuilder.create().addResourcePinnedToMasterSplit(nonExistentResourceId)).addModule("feature", module -> module.setResourceTable(resourceTable).setManifest(androidManifest("com.test.app"))).build();
InvalidBundleException e = assertThrows(InvalidBundleException.class, () -> new BundleConfigValidator().validateBundle(appBundle));
assertThat(e).hasMessageThat().contains("The Master Resources list contains resource IDs not defined in any module. " + "For example: 0x7f010001");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class BundleConfigValidatorTest method version_invalid_throws.
@Test
public void version_invalid_throws() throws Exception {
AppBundle appBundle = createAppBundle(BundleConfigBuilder.create().setVersion("blah"));
InvalidBundleException e = assertThrows(InvalidBundleException.class, () -> new BundleConfigValidator().validateBundle(appBundle));
assertThat(e).hasMessageThat().contains("Invalid version");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class BundleFilesValidatorTest method validateApexFile_repeatingAbis_throws.
@Test
public void validateApexFile_repeatingAbis_throws() throws Exception {
ZipPath repeatingAbisFile = ZipPath.create("apex/x86.x86_64.x86.img");
InvalidBundleException e = assertThrows(InvalidBundleException.class, () -> new BundleFilesValidator().validateModuleFile(repeatingAbisFile));
assertThat(e).hasMessageThat().contains("Repeating architectures in APEX system image file");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class BundleFilesValidatorTest method validateLibFile_nonSoExtension_throws.
@Test
public void validateLibFile_nonSoExtension_throws() throws Exception {
ZipPath nonSoFile = ZipPath.create("lib/x86/libX.dat");
InvalidBundleException e = assertThrows(InvalidBundleException.class, () -> new BundleFilesValidator().validateModuleFile(nonSoFile));
assertThat(e).hasMessageThat().contains("Files under lib/ must have .so extension");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class BundleFilesValidatorTest method validateApexFile_nonImgExtension_throws.
@Test
public void validateApexFile_nonImgExtension_throws() throws Exception {
ZipPath nonImgFile = ZipPath.create("apex/x86.dat");
InvalidBundleException e = assertThrows(InvalidBundleException.class, () -> new BundleFilesValidator().validateModuleFile(nonImgFile));
assertThat(e).hasMessageThat().contains("Files under apex/ must have .img extension");
}
Aggregations