コード例 #1
0
  @Test
  public void ableToCreateAbsoluteUrls() {
    final TestBuilder builder = createBuilder("prefix", null);
    builder.key("key").url("https://atlassian.com");
    builder.addParameter("what", "string");

    final HelpUrlMatcher matcher = new HelpUrlMatcher().key("key").url("https://atlassian.com");
    assertThat(builder.build(), matcher);

    builder.url("httP://atlassian.com");
    matcher.url("httP://atlassian.com");
    assertThat(builder.build(), matcher);
  }
コード例 #2
0
  @Test
  public void ableToCreateUrlWithExtraParameters() {
    final TestBuilder builder = createBuilder("prefix", null);
    builder.key("key").url("url#anchor");
    builder.addParameter("what", "string");

    final HelpUrlMatcher matcher =
        new HelpUrlMatcher().key("key").url("prefixurl?what=string#anchor");
    assertThat(builder.build(), matcher);

    builder.url("url?a=b");
    matcher.url("prefixurl?a=b&what=string");
    assertThat(builder.build(), matcher);

    builder.addParameter("what2", "string2");
    matcher.url("prefixurl?a=b&what=string&what2=string2");
    assertThat(builder.build(), matcher);
  }