### Question:
Paths { public static Path parse(String path) { return path.isEmpty() ? ImmutablePath.EMPTY : ImmutablePath.create(new PathBuilder().splitAndAdd(path, true)); }  static Path of(String... segments); static Path parse(String path); static Path empty();  }### Answer:
@Test public void resolve() { assertEquals(Paths.parse("/home/file.pdf"), Paths.parse("/home/dir").resolve("file.pdf")); assertEquals(Paths.parse("/home/dir/file.pdf"), Paths.parse("/home/dir/").resolve("file.pdf")); }
@Test public void resolve_rfc3986() { Path base = Paths.parse("/b/c/d;p"); assertEquals(Paths.parse("/b/c/g"), base.resolve("g")); assertEquals(Paths.parse("/b/c/g"), base.resolve("./g")); assertEquals(Paths.parse("/b/c/g/"), base.resolve("g/")); assertEquals(Paths.parse("/g"), base.resolve("/g")); assertEquals(Paths.parse("/b/c/d;p"), base.resolve("")); assertEquals(Paths.parse("/b/c/"), base.resolve(".")); assertEquals(Paths.parse("/b/c/"), base.resolve("./")); assertEquals(Paths.parse("/b/"), base.resolve("..")); assertEquals(Paths.parse("/b/"), base.resolve("../")); assertEquals(Paths.parse("/b/g"), base.resolve("../g")); assertEquals(Paths.parse("/"), base.resolve("../..")); assertEquals(Paths.parse("/"), base.resolve("../../")); assertEquals(Paths.parse("/"), base.resolve("../../..")); assertEquals(Paths.parse("/g"), base.resolve("../../../g")); assertEquals(Paths.parse("/g"), base.resolve("/./g")); assertEquals(Paths.parse("/g"), base.resolve("/../g")); assertEquals(Paths.parse("/b/c/g."), base.resolve("g.")); assertEquals(Paths.parse("/b/c/.g"), base.resolve(".g")); assertEquals(Paths.parse("/b/c/..g"), base.resolve("..g")); assertEquals(Paths.parse("/b/c/g.."), base.resolve("g..")); assertEquals(Paths.parse("/b/g"), base.resolve("./../g")); assertEquals(Paths.parse("/b/c/g/"), base.resolve("./g/.")); assertEquals(Paths.parse("/b/c/g/h"), base.resolve("g/./h")); assertEquals(Paths.parse("/b/c/h"), base.resolve("g/../h")); assertEquals(Paths.parse("/b/c/g;x=1/y"), base.resolve("g;x=1/./y")); assertEquals(Paths.parse("/b/c/y"), base.resolve("g;x=1/../y")); }