Search in sources :

Example 26 with InvalidCommandException

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

the class BuildApksCommandTest method systemApkOptions_nonSystemMode_throws.

@Test
public void systemApkOptions_nonSystemMode_throws() throws Exception {
    InvalidCommandException flagsException = assertThrows(InvalidCommandException.class, () -> BuildApksCommand.fromFlags(new FlagParser().parse("--bundle=" + bundlePath, "--output=" + outputFilePath, "--mode=" + DEFAULT, "--system-apk-options=" + UNCOMPRESSED_NATIVE_LIBRARIES), fakeAdbServer));
    assertThat(flagsException).hasMessageThat().contains("'system-apk-options' flag is available in system mode only.");
}
Also used : InvalidCommandException(com.android.tools.build.bundletool.model.exceptions.InvalidCommandException) FlagParser(com.android.tools.build.bundletool.flags.FlagParser) Test(org.junit.Test)

Aggregations

InvalidCommandException (com.android.tools.build.bundletool.model.exceptions.InvalidCommandException)26 Test (org.junit.Test)26 FlagParser (com.android.tools.build.bundletool.flags.FlagParser)12 ZipPath (com.android.tools.build.bundletool.model.ZipPath)6 BuildApksResult (com.android.bundle.Commands.BuildApksResult)4 DeviceSpec (com.android.bundle.Devices.DeviceSpec)3 ImmutableSet (com.google.common.collect.ImmutableSet)3 Path (java.nio.file.Path)3 SystemEnvironmentProvider (com.android.tools.build.bundletool.model.utils.SystemEnvironmentProvider)1 FakeSystemEnvironmentProvider (com.android.tools.build.bundletool.testing.FakeSystemEnvironmentProvider)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintStream (java.io.PrintStream)1