Search in sources :

Example 1 with RequiredFlagNotSetException

use of com.android.tools.build.bundletool.flags.Flag.RequiredFlagNotSetException in project bundletool by google.

the class TestUtils method expectMissingRequiredFlagException.

/**
 * Tests that missing mandatory command line argument is detected.
 */
public static void expectMissingRequiredFlagException(String flag, Executable runnable) {
    RequiredFlagNotSetException exception = assertThrows(RequiredFlagNotSetException.class, runnable);
    assertThat(exception).hasMessageThat().contains(String.format("Missing the required --%s flag", flag));
}
Also used : RequiredFlagNotSetException(com.android.tools.build.bundletool.flags.Flag.RequiredFlagNotSetException)

Example 2 with RequiredFlagNotSetException

use of com.android.tools.build.bundletool.flags.Flag.RequiredFlagNotSetException in project bundletool by google.

the class FlagParserTest method requiredFlagNotPresent_throws.

@Test
public void requiredFlagNotPresent_throws() throws Exception {
    ParsedFlags fp = new FlagParser().parse("command", "--flag1=value1");
    RequiredFlagNotSetException e = assertThrows(RequiredFlagNotSetException.class, () -> Flag.string("flag2").getRequiredValue(fp));
    assertThat(e).hasMessageThat().contains("Missing the required --flag2 flag");
}
Also used : RequiredFlagNotSetException(com.android.tools.build.bundletool.flags.Flag.RequiredFlagNotSetException) Test(org.junit.Test)

Aggregations

RequiredFlagNotSetException (com.android.tools.build.bundletool.flags.Flag.RequiredFlagNotSetException)2 Test (org.junit.Test)1