use of com.android.tools.build.bundletool.flags.FlagParser.FlagParseException in project bundletool by google.
the class BuildApksCommandTest method nonPositiveMaxThreads_throws.
@Test
public void nonPositiveMaxThreads_throws() throws Exception {
FlagParseException zeroException = assertThrows(FlagParseException.class, () -> BuildApksCommand.fromFlags(new FlagParser().parse("--bundle=" + bundlePath, "--output=" + outputFilePath, "--max-threads=0"), fakeAdbServer));
assertThat(zeroException).hasMessageThat().contains("flag --max-threads has illegal value");
FlagParseException negativeException = assertThrows(FlagParseException.class, () -> BuildApksCommand.fromFlags(new FlagParser().parse("--bundle=" + bundlePath, "--output=" + outputFilePath, "--max-threads=-1"), fakeAdbServer));
assertThat(negativeException).hasMessageThat().contains("flag --max-threads has illegal value");
}
use of com.android.tools.build.bundletool.flags.FlagParser.FlagParseException in project bundletool by google.
the class FlagParserTest method incorrectCommandLineFlags_throws.
@Test
public void incorrectCommandLineFlags_throws() throws Exception {
FlagParseException e = assertThrows(FlagParseException.class, () -> new FlagParser().parse("command", "--flag1=value1", "-flag2=value2"));
assertThat(e).hasMessageThat().contains("-flag2=value2");
}
use of com.android.tools.build.bundletool.flags.FlagParser.FlagParseException in project bundletool by google.
the class FlagParserTest method listFlag_setMultipleTimes_throws.
@Test
public void listFlag_setMultipleTimes_throws() throws Exception {
ParsedFlags fp = new FlagParser().parse("command", "--flag1=v1", "--flag1=v2");
FlagParseException e = assertThrows(FlagParseException.class, () -> Flag.stringList("flag1").getRequiredValue(fp));
assertThat(e).hasMessageThat().contains("Flag --flag1 has been set more than once");
}
use of com.android.tools.build.bundletool.flags.FlagParser.FlagParseException in project bundletool by google.
the class FlagParserTest method listFlag_setMultipleTimesMixedSeparators_throws.
@Test
public void listFlag_setMultipleTimesMixedSeparators_throws() throws Exception {
ParsedFlags fp = new FlagParser().parse("command", "--flag1", "v1", "--flag1=v2");
FlagParseException e = assertThrows(FlagParseException.class, () -> Flag.stringList("flag1").getRequiredValue(fp));
assertThat(e).hasMessageThat().contains("Flag --flag1 has been set more than once");
}
use of com.android.tools.build.bundletool.flags.FlagParser.FlagParseException in project bundletool by google.
the class FlagTest method nonNegativeIntegerFlag_negative_throws.
@Test
public void nonNegativeIntegerFlag_negative_throws() throws Exception {
Flag<Integer> flag = Flag.nonNegativeInteger("testFlag");
ParsedFlags parsedFlags = new FlagParser().parse("--testFlag=-1");
FlagParseException exception = assertThrows(FlagParseException.class, () -> flag.getValue(parsedFlags));
assertThat(exception).hasMessageThat().contains("has illegal value");
}
Aggregations