use of com.android.tools.build.bundletool.model.exceptions.InvalidCommandException in project bundletool by google.
the class BuildApksCommandTest method stampKeystoreFlags_noKeyAlias_fails.
@Test
public void stampKeystoreFlags_noKeyAlias_fails() {
InvalidCommandException e = assertThrows(InvalidCommandException.class, () -> BuildApksCommand.fromFlags(new FlagParser().parse("--bundle=" + bundlePath, "--output=" + outputFilePath, "--aapt2=" + AAPT2_PATH, "--create-stamp=" + true, "--stamp-ks=" + keystorePath), fakeAdbServer));
assertThat(e).hasMessageThat().isEqualTo("Flag --stamp-key-alias or --ks-key-alias are required when --stamp-ks or --ks are" + " set.");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidCommandException in project bundletool by google.
the class BuildApksCommandTest method modulesFlagWithDefault_throws.
@Test
public void modulesFlagWithDefault_throws() throws Exception {
InvalidCommandException builderException = assertThrows(InvalidCommandException.class, () -> BuildApksCommand.builder().setBundlePath(bundlePath).setOutputFile(outputFilePath).setAapt2Command(aapt2Command).setApkBuildMode(DEFAULT).setModules(ImmutableSet.of("base")).build());
assertThat(builderException).hasMessageThat().contains("Modules can be only set when running with 'universal' or 'system' mode flag.");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidCommandException in project bundletool by google.
the class BuildApksCommandTest method keystoreFlags_keyAliasNotSet.
@Test
public void keystoreFlags_keyAliasNotSet() {
InvalidCommandException e = assertThrows(InvalidCommandException.class, () -> BuildApksCommand.fromFlags(new FlagParser().parse("--bundle=" + bundlePath, "--output=" + outputFilePath, "--aapt2=" + AAPT2_PATH, "--ks=" + keystorePath), fakeAdbServer));
assertThat(e).hasMessageThat().isEqualTo("Flag --ks-key-alias is required when --ks is set.");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidCommandException in project bundletool by google.
the class BuildApksCommandTest method lineageFlag_noOldestSigner_fails.
@Test
public void lineageFlag_noOldestSigner_fails() {
InvalidCommandException e = assertThrows(InvalidCommandException.class, () -> BuildApksCommand.fromFlags(new FlagParser().parse("--bundle=" + bundlePath, "--output=" + outputFilePath, "--aapt2=" + AAPT2_PATH, "--ks=" + keystorePath, "--ks-key-alias=" + KEY_ALIAS, "--ks-pass=pass:" + KEYSTORE_PASSWORD, "--key-pass=pass:" + KEY_PASSWORD, "--lineage=" + tmpDir.resolve("lineage-file")), fakeAdbServer));
assertThat(e).hasMessageThat().isEqualTo("Flag 'oldest-signer' is required when 'lineage' is set.");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidCommandException in project bundletool by google.
the class InstallMultiApksCommandTest method fromFlags_missingApksOption.
@Test
public void fromFlags_missingApksOption() {
InvalidCommandException e = assertThrows(InvalidCommandException.class, () -> InstallMultiApksCommand.fromFlags(new FlagParser().parse(), systemEnvironmentProvider, fakeServerOneDevice(qDeviceWithLocales("en-US"))));
assertThat(e).hasMessageThat().contains("Exactly one of");
}
Aggregations