@Test public void shouldNotAcceptInvalidEncryption() throws Exception { thrown.expect( ArgumentParserException.class ); thrown.expectMessage( containsString("argument --encryption: invalid choice: 'bugaluga' (choose from {true,false,default})")); CliArgHelper.parseAndThrow("--encryption", "bugaluga"); }
public static CliArgs parseAndThrow( @Nonnull String... args ) throws ArgumentParserException { final CliArgs cliArgs = new CliArgs(); final ArgumentParser parser = setupParser( cliArgs.getParameters() ); final Namespace ns = parser.parseArgs( args ); return getCliArgs( cliArgs, parser, ns ); }
CliArgHelper { public static CliArgs parseAndThrow( @Nonnull String... args ) throws ArgumentParserException { final CliArgs cliArgs = new CliArgs(); final ArgumentParser parser = setupParser( cliArgs.getParameters() ); final Namespace ns = parser.parseArgs( args ); return getCliArgs( cliArgs, parser, ns ); } }
CliArgHelper { public static CliArgs parseAndThrow( @Nonnull String... args ) throws ArgumentParserException { final CliArgs cliArgs = new CliArgs(); final ArgumentParser parser = setupParser( cliArgs.getParameters() ); final Namespace ns = parser.parseArgs( args ); return getCliArgs( cliArgs, parser, ns ); }  }
CliArgHelper { public static CliArgs parseAndThrow( @Nonnull String... args ) throws ArgumentParserException { final CliArgs cliArgs = new CliArgs(); final ArgumentParser parser = setupParser( cliArgs.getParameters() ); final Namespace ns = parser.parseArgs( args ); return getCliArgs( cliArgs, parser, ns ); }  @Nullable static CliArgs parse(@Nonnull String... args); static CliArgs parseAndThrow( @Nonnull String... args ); }
CliArgHelper { public static CliArgs parseAndThrow( @Nonnull String... args ) throws ArgumentParserException { final CliArgs cliArgs = new CliArgs(); final ArgumentParser parser = setupParser( cliArgs.getParameters() ); final Namespace ns = parser.parseArgs( args ); return getCliArgs( cliArgs, parser, ns ); }  @Nullable static CliArgs parse(@Nonnull String... args); static CliArgs parseAndThrow( @Nonnull String... args );  }