コード例 #1
0
  @Test
  public void it_should_reset_properly() {
    schemeBuilder.addOption(unkownOpt);
    schemeBuilder.reset();
    schemeBuilder.addOption(firstOpt);

    CommandScheme scheme = schemeBuilder.buildScheme();
    assertThat(scheme.hasOption("unknown option"), is(false));
    assertThat(scheme.hasOption("basic option"), is(true));
  }
コード例 #2
0
  @Test
  public void it_should_produce_a_scheme_that_knows_only_the_added_options() {
    schemeBuilder.addOption(firstOpt);
    CommandScheme scheme = schemeBuilder.buildScheme();

    assertThat(scheme.hasOption("unknown option"), is(false));
  }
コード例 #3
0
  @Test
  public void it_should_build_a_scheme() {
    schemeBuilder.addOption(firstOpt);
    CommandScheme scheme = schemeBuilder.buildScheme();

    assertThat(scheme.hasOption("basic option"), is(true));
  }
コード例 #4
0
 @Test(expected = IllegalArgumentException.class)
 public void it_should_complain_when_adding_options_twice() {
   schemeBuilder.addOption(firstOpt);
   schemeBuilder.addOption(firstOpt);
   fail("Only one option with a specific long representation is allowed");
 }