use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.
the class ValidateBundleCommandTest method corruptedBundleFile_throws.
@Test
public void corruptedBundleFile_throws() throws Exception {
ParsedFlags flags = new FlagParser().parse("--bundle=" + bundlePath);
ValidateBundleCommand command = ValidateBundleCommand.fromFlags(flags);
assertThrows(UncheckedIOException.class, () -> command.execute());
}
use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.
the class ValidateBundleCommandTest method bundleNotSet_throws.
@Test
public void bundleNotSet_throws() throws Exception {
expectMissingRequiredBuilderPropertyException("bundlePath", () -> ValidateBundleCommand.builder().build());
expectMissingRequiredFlagException("bundle", () -> ValidateBundleCommand.fromFlags(new FlagParser().parse()));
}
use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.
the class ValidateBundleCommandTest method missingBundleFile_throws.
@Test
public void missingBundleFile_throws() throws Exception {
ParsedFlags flags = new FlagParser().parse("--bundle=doesnt-exist");
ValidateBundleCommand command = ValidateBundleCommand.fromFlags(flags);
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> command.execute());
assertThat(exception.getMessage()).matches("File '.*' was not found.");
}
use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.
the class CheckTransparencyCommandTest method buildingCommandViaFlags_apkMode_unknownFlagSet.
@Test
public void buildingCommandViaFlags_apkMode_unknownFlagSet() {
Throwable e = assertThrows(UnknownFlagsException.class, () -> CheckTransparencyCommand.fromFlags(new FlagParser().parse("--mode=APK", "--apk-zip=" + bundlePath, "--unknownFlag=hello"), systemEnvironmentProvider, fakeAdbServer));
assertThat(e).hasMessageThat().contains("Unrecognized flags");
}
use of com.android.tools.build.bundletool.flags.FlagParser in project bundletool by google.
the class CheckTransparencyCommandTest method buildingCommandViaFlags_connectedDeviceMode_bundleFlagSet.
@Test
public void buildingCommandViaFlags_connectedDeviceMode_bundleFlagSet() {
Throwable e = assertThrows(UnknownFlagsException.class, () -> CheckTransparencyCommand.fromFlags(new FlagParser().parse("--mode=CONNECTED_DEVICE", "--adb=" + ADB_PATH, "--package-name=" + PACKAGE_NAME, "--bundle=" + bundlePath), systemEnvironmentProvider, fakeAdbServer));
assertThat(e).hasMessageThat().contains("Unrecognized flags");
}
Aggregations