### Question:
GlusterPath implements Path { @Override public Path resolve(Path path) { GlusterPath otherPath = (GlusterPath) path; if (!fileSystem.equals(otherPath.getFileSystem())) { throw new IllegalArgumentException("Can not resolve other path because it's on a different filesystem"); } if (otherPath.isAbsolute() || (absolute && parts.length == 1 && parts[0].isEmpty())) { return new GlusterPath(fileSystem, otherPath.getParts(), true); } if (otherPath.getParts().length == 1 && otherPath.getParts()[0].isEmpty()) { return this; } String[] newParts = Arrays.copyOf(parts, parts.length + otherPath.getParts().length); System.arraycopy(otherPath.getParts(), 0, newParts, parts.length, otherPath.getParts().length); return new GlusterPath(fileSystem, newParts, absolute); } GlusterPath(GlusterFileSystem fileSystem, String path);   GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isAbsolute(); @Override Path getRoot(); @Override Path getFileName(); @Override Path getParent(); @Override int getNameCount(); @Override Path getName(int i); @Override Path subpath(int i, int i2); @Override boolean startsWith(Path path); @Override boolean startsWith(String s); @Override boolean endsWith(Path path); @Override boolean endsWith(String s); @Override Path normalize(); @Override Path resolve(Path path); @Override Path resolve(String s); @Override Path resolveSibling(Path path); @Override Path resolveSibling(String s); @Override Path relativize(Path path); @Override URI toUri(); @Override Path toAbsolutePath(); @Override Path toRealPath(LinkOption... linkOptions); @Override File toFile(); @Override WatchKey register(WatchService watchService, WatchEvent.Kind<?>[] kinds, WatchEvent.Modifier... modifiers); @Override WatchKey register(WatchService watchService, WatchEvent.Kind<?>... kinds); @Override Iterator<Path> iterator(); @Override int compareTo(Path path); String toString(); String getString();  }### Answer:
@Test public void testResolve() { Path path = new GlusterPath(mockFileSystem, "/"); Path otherPath = new GlusterPath(mockFileSystem, "/bar"); assertEquals(otherPath, path.resolve(otherPath)); otherPath = new GlusterPath(mockFileSystem, "bar"); assertEquals(new GlusterPath(mockFileSystem, "/bar"), path.resolve(otherPath)); otherPath = new GlusterPath(mockFileSystem, ""); assertEquals(path, path.resolve(otherPath)); }
@Test public void testResolve_string() { Path path = new GlusterPath(mockFileSystem, "/"); assertEquals(new GlusterPath(mockFileSystem, "/bar"), path.resolve("/bar")); assertEquals(new GlusterPath(mockFileSystem, "/bar"), path.resolve("bar")); assertEquals(path, path.resolve("")); path = new GlusterPath(mockFileSystem, "/foo"); assertEquals(new GlusterPath(mockFileSystem, "/foo/bar"), path.resolve("bar")); }