@VisibleForTesting
  boolean isMounted(String ufs) {
    ufs = PathUtils.normalizePath(ufs, AlluxioURI.SEPARATOR);
    for (Map.Entry<String, MountPointInfo> entry :
        mFileSystemMaster.getMountPointInfoSummary(false).entrySet()) {
      String escaped = MetricsSystem.escape(new AlluxioURI(entry.getValue().getUfsUri()));
      escaped = PathUtils.normalizePath(escaped, AlluxioURI.SEPARATOR);
      if (escaped.equals(ufs)) {
        return true;
      }
    }
    return false;
  }
@Test
  public void isMounted() {
    String s3Uri = "s3a://test/dir_1/dir-2";
    String hdfsUri = "hdfs://test";

    Map<String, MountPointInfo> mountTable = new HashMap<>();
    mountTable.put("/s3", new MountPointInfo().setUfsUri(s3Uri));
    FileSystemMaster mockMaster = mock(FileSystemMaster.class);
    when(mockMaster.getMountPointInfoSummary(false)).thenReturn(mountTable);

    AlluxioMasterProcess masterProcess = PowerMockito.mock(AlluxioMasterProcess.class);
    when(masterProcess.getMaster(FileSystemMaster.class)).thenReturn(mockMaster);

    ServletContext context = mock(ServletContext.class);
    when(context.getAttribute(MasterWebServer.ALLUXIO_MASTER_SERVLET_RESOURCE_KEY)).thenReturn(
        masterProcess);
    AlluxioMasterRestServiceHandler handler = new AlluxioMasterRestServiceHandler(context);

    assertFalse(handler.isMounted(s3Uri));
    assertTrue(handler.isMounted(MetricsSystem.escape(new AlluxioURI(s3Uri))));
    assertTrue(handler.isMounted(MetricsSystem.escape(new AlluxioURI(s3Uri + "/"))));
    assertFalse(handler.isMounted(hdfsUri));
    assertFalse(handler.isMounted(MetricsSystem.escape(new AlluxioURI(hdfsUri))));
  }