### Question:
DistCpUtils { public static String getRelativePath(Path sourceRootPath, Path childPath) { String childPathString = childPath.toUri().getPath(); String sourceRootPathString = sourceRootPath.toUri().getPath(); return sourceRootPathString.equals("/") ? childPathString : childPathString.substring(sourceRootPathString.length()); }  static long getFileSize(Path path, Configuration configuration); static void publish(Configuration configuration,
                                 String label, T value); static int getInt(Configuration configuration, String label); static long getLong(Configuration configuration, String label); static Class<? extends InputFormat> getStrategy(Configuration conf,
                                                                 DistCpOptions options); static String getRelativePath(Path sourceRootPath, Path childPath); static String packAttributes(EnumSet<FileAttribute> attributes); static EnumSet<FileAttribute> unpackAttributes(String attributes); static void preserve(FileSystem targetFS, Path path,
                              CopyListingFileStatus srcFileStatus,
                              EnumSet<FileAttribute> attributes,
                              boolean preserveRawXattrs); static List<AclEntry> getAcl(FileSystem fileSystem,
      FileStatus fileStatus); static Map<String, byte[]> getXAttrs(FileSystem fileSystem,
      Path path); static CopyListingFileStatus toCopyListingFileStatus(
      FileSystem fileSystem, FileStatus fileStatus, boolean preserveAcls, 
      boolean preserveXAttrs, boolean preserveRawXAttrs); static Path sortListing(FileSystem fs, Configuration conf, Path sourceListing); static void checkFileSystemAclSupport(FileSystem fs); static void checkFileSystemXAttrSupport(FileSystem fs); static DecimalFormat getFormatter(); static String getStringDescriptionFor(long nBytes); static boolean checksumsAreEqual(FileSystem sourceFS, Path source,
      FileChecksum sourceChecksum, FileSystem targetFS, Path target); static boolean compareFs(FileSystem srcFs, FileSystem destFs);  }### Answer:
@Test public void testGetRelativePathRoot() { Path root = new Path("/tmp/abc"); Path child = new Path("/tmp/abc/xyz/file"); Assert.assertEquals(DistCpUtils.getRelativePath(root, child), "/xyz/file"); root = new Path("/"); child = new Path("/a"); Assert.assertEquals(DistCpUtils.getRelativePath(root, child), "/a"); }
@Test public void testGetRelativePathRoot() { Path root = new Path("/"); Path child = new Path("/a"); Assert.assertEquals(DistCpUtils.getRelativePath(root, child), "/a"); }
@Test public void testGetRelativePath() { Path root = new Path("/tmp/abc"); Path child = new Path("/tmp/abc/xyz/file"); Assert.assertEquals(DistCpUtils.getRelativePath(root, child), "/xyz/file"); }