Arguments { @Nonnull public Charset getDefaultCharset() { return defaultCharset; }  @Nonnegative int getMaxFileSizeBytes(); @Nonnegative int getMaxRedirectHops(); @Nonnull Charset getDefaultCharset(); @Nonnull List<URI> getResources(); @Nonnull String getAgent(); boolean isHelpRequested(); @Nonnegative int getReadTimeoutMillis(); @Nonnull RobotsConfig buildRobotsConfig();  }
@Test public void givenCharsetUnset_whenInit_thenCharsetIsUtf8() { jCommander.parse(array(FIRST_RESOURCE)); assertThat(arguments.getDefaultCharset(), equalTo(Charsets.UTF_8)); }
@Test public void givenCArgument_whenInit_thenDefaultCharsetIsExpected() { jCommander.parse(array("-c", "UTF-8", FIRST_RESOURCE)); assertThat(arguments.getDefaultCharset(), equalTo(Charsets.UTF_8)); }
@Test public void givenCharsetArgument_whenInit_thenDefaultCharsetIsExpected() { jCommander.parse(array("--charset", "UTF-8", FIRST_RESOURCE)); assertThat(arguments.getDefaultCharset(), equalTo(Charsets.UTF_8)); }
@Test public void givenDefaultCharsetArgument_whenInit_thenDefaultCharsetIsExpected() { jCommander.parse(array("--defaultCharset", "UTF-16", FIRST_RESOURCE)); assertThat(arguments.getDefaultCharset(), equalTo(Charsets.UTF_16)); }
@Test(expected = ParameterException.class) public void givenInvalidCharsetArgument_whenInit_thenThrowsParameterException() { jCommander.parse(array("-c", "NOT_A_VALID_CHARSET", FIRST_RESOURCE)); assertThat(arguments.getDefaultCharset(), equalTo(Charsets.US_ASCII)); }