@Test
  public void testRemoveWALRootPath() throws Exception {
    CommonFSUtils.setRootDir(conf, new Path("file:///user/hbase"));
    Path testFile = new Path(CommonFSUtils.getRootDir(conf), "test/testfile");
    Path tmpFile = new Path("file:///test/testfile");
    assertEquals("test/testfile", CommonFSUtils.removeWALRootPath(testFile, conf));
    assertEquals(tmpFile.toString(), CommonFSUtils.removeWALRootPath(tmpFile, conf));
    CommonFSUtils.setWALRootDir(conf, new Path("file:///user/hbaseLogDir"));
    assertEquals(testFile.toString(), CommonFSUtils.removeWALRootPath(testFile, conf));
    Path logFile = new Path(CommonFSUtils.getWALRootDir(conf), "test/testlog");
    assertEquals("test/testlog", CommonFSUtils.removeWALRootPath(logFile, conf));
  }
Test path compare and prefix checking.
hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestCommonFSUtils.java