static CliArguments fromRawArgs(String[] rawArgs) throws CliArgumentsException {
        CommandLineParser parser = new DefaultParser();
        try {
            return new CliArguments(parser.parse(optionsDefinition, rawArgs));
        } catch (ParseException e) {
            throw new CliArgumentsException(e);
        }
    }
@Test
    void fails_on_conflicting_parameters() throws CliArgumentsException {
        assertEquals("Exactly one of 'file' and 'stdin' must be specified",
                     assertThrows(CliArgumentsException.class,
                                  () -> CliArguments.fromRawArgs(new String[] {"--endpoint", "https://endpoint", "--file", "/path/to/file", "--stdin"}))
                             .getMessage());

        assertEquals("Exactly one of 'file' and 'stdin' must be specified",
                     assertThrows(CliArgumentsException.class,
                                  () -> CliArguments.fromRawArgs(new String[] {"--endpoint", "https://endpoint"}))
                             .getMessage());

        assertEquals("At most one of 'file', 'stdin' and 'test-payload-size' may be specified",
                     assertThrows(CliArgumentsException.class,
                                  () -> CliArguments.fromRawArgs(new String[] {"--endpoint", "https://endpoint", "--speed-test", "--test-payload-size", "123", "--file", "file"}))
                             .getMessage());

        CliArguments.fromRawArgs(new String[] {"--endpoint", "foo", "--speed-test"});
    }