@Test
public void testResolveAbnormal() {

  String base = "http://a/b/c/d;p?q";
  assertThat(resolve(base, "../../../g")).isEqualTo("http://a/g");
  assertThat(resolve(base, "../../../../g")).isEqualTo("http://a/g");
  assertThat(resolve(base, "/./g")).isEqualTo("http://a/g");
  assertThat(resolve(base, "/../g")).isEqualTo("http://a/g");
  assertThat(resolve(base, "g.")).isEqualTo("http://a/b/c/g.");
  assertThat(resolve(base, ".g")).isEqualTo("http://a/b/c/.g");
  assertThat(resolve(base, "g..")).isEqualTo("http://a/b/c/g..");
  assertThat(resolve(base, "..g")).isEqualTo("http://a/b/c/..g");
  assertThat(resolve(base, "./../g")).isEqualTo("http://a/b/g");
  assertThat(resolve(base, "./g/.")).isEqualTo("http://a/b/c/g/");
  assertThat(resolve(base, "g/./h")).isEqualTo("http://a/b/c/g/h");
  assertThat(resolve(base, "g/../h")).isEqualTo("http://a/b/c/h");
  assertThat(resolve(base, "g;x=1/./y")).isEqualTo("http://a/b/c/g;x=1/y");
  assertThat(resolve(base, "g;x=1/../y")).isEqualTo("http://a/b/c/y");
  assertThat(resolve(base, "g?y/./x")).isEqualTo("http://a/b/c/g?y/./x");
  assertThat(resolve(base, "g?y/../x")).isEqualTo("http://a/b/c/g?y/../x");
  assertThat(resolve(base, "g#s/./x")).isEqualTo("http://a/b/c/g#s/./x");
  assertThat(resolve(base, "g#s/../x")).isEqualTo("http://a/b/c/g#s/../x");
  assertThat(resolve(base, "http:g")).isEqualTo("http:g");
}