Search in sources :

Example 11 with CommandExecutionException

use of com.android.tools.build.bundletool.model.exceptions.CommandExecutionException in project bundletool by google.

the class SigningConfigurationTest method extractFromKeystore_wrongKeystorePassword.

@Test
public void extractFromKeystore_wrongKeystorePassword() throws Exception {
    Path keystorePath = createKeystore();
    CommandExecutionException e = assertThrows(CommandExecutionException.class, () -> SigningConfiguration.extractFromKeystore(keystorePath, KEY_ALIAS, Optional.of(Password.createForTest("WrongPassword")), Optional.of(Password.createForTest(KEY_PASSWORD))));
    assertThat(e).hasMessageThat().contains("Incorrect keystore password");
}
Also used : Path(java.nio.file.Path) CommandExecutionException(com.android.tools.build.bundletool.model.exceptions.CommandExecutionException) Test(org.junit.Test)

Example 12 with CommandExecutionException

use of com.android.tools.build.bundletool.model.exceptions.CommandExecutionException in project bundletool by google.

the class BundleToolErrorTest method testCommandExecution_causeNoMessage.

@Test
public void testCommandExecution_causeNoMessage() {
    CommandExecutionException exception = CommandExecutionException.builder().withCause(new IllegalArgumentException("internal")).build();
    assertError(exception.toProto(), ErrorType.COMMAND_EXECUTION_ERROR, "", "java.lang.IllegalArgumentException: internal");
}
Also used : CommandExecutionException(com.android.tools.build.bundletool.model.exceptions.CommandExecutionException) Test(org.junit.Test)

Example 13 with CommandExecutionException

use of com.android.tools.build.bundletool.model.exceptions.CommandExecutionException in project bundletool by google.

the class BundleToolErrorTest method testCommandExecution.

@Test
public void testCommandExecution() {
    CommandExecutionException exception = CommandExecutionException.builder().withInternalMessage("%s id:%d", "internal", 12).build();
    assertError(exception.toProto(), ErrorType.COMMAND_EXECUTION_ERROR, "", "internal id:12");
}
Also used : CommandExecutionException(com.android.tools.build.bundletool.model.exceptions.CommandExecutionException) Test(org.junit.Test)

Example 14 with CommandExecutionException

use of com.android.tools.build.bundletool.model.exceptions.CommandExecutionException in project bundletool by google.

the class FusingAndroidManifestMergerTest method duplicateManifest_throws.

@Test
public void duplicateManifest_throws() {
    SetMultimap<BundleModuleName, AndroidManifest> manifests = ImmutableSetMultimap.of(BASE_MODULE_NAME, AndroidManifest.create(androidManifest("com.testapp1")), BASE_MODULE_NAME, AndroidManifest.create(androidManifest("com.testapp2")));
    CommandExecutionException exception = assertThrows(CommandExecutionException.class, () -> createMerger(Mode.REPLACE).merge(manifests));
    assertThat(exception).hasMessageThat().isEqualTo("Expected exactly one base module manifest, but found 2.");
}
Also used : BundleModuleName(com.android.tools.build.bundletool.model.BundleModuleName) AndroidManifest(com.android.tools.build.bundletool.model.AndroidManifest) CommandExecutionException(com.android.tools.build.bundletool.model.exceptions.CommandExecutionException) Test(org.junit.Test)

Example 15 with CommandExecutionException

use of com.android.tools.build.bundletool.model.exceptions.CommandExecutionException in project bundletool by google.

the class MergingUtilsTest method mergeShardTargetings_sdkTargetingSecondTargeting_throws.

@Test
public void mergeShardTargetings_sdkTargetingSecondTargeting_throws() {
    ApkTargeting targeting = apkMinSdkTargeting(1);
    CommandExecutionException exception = assertThrows(CommandExecutionException.class, () -> MergingUtils.mergeShardTargetings(apkAbiTargeting(AbiAlias.X86), targeting));
    assertThat(exception).hasMessageThat().contains("Expecting only ABI, screen density, language and texture compression format" + " targeting");
}
Also used : ApkTargeting(com.android.bundle.Targeting.ApkTargeting) TargetingUtils.mergeApkTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeApkTargeting) CommandExecutionException(com.android.tools.build.bundletool.model.exceptions.CommandExecutionException) Test(org.junit.Test)

Aggregations

CommandExecutionException (com.android.tools.build.bundletool.model.exceptions.CommandExecutionException)16 Test (org.junit.Test)16 Path (java.nio.file.Path)6 AndroidManifest (com.android.tools.build.bundletool.model.AndroidManifest)3 BundleModuleName (com.android.tools.build.bundletool.model.BundleModuleName)3 ApkTargeting (com.android.bundle.Targeting.ApkTargeting)2 BundleModule (com.android.tools.build.bundletool.model.BundleModule)2 BundleModuleBuilder (com.android.tools.build.bundletool.testing.BundleModuleBuilder)2 TargetingUtils.mergeApkTargeting (com.android.tools.build.bundletool.testing.TargetingUtils.mergeApkTargeting)2 FlagParser (com.android.tools.build.bundletool.flags.FlagParser)1