@Override
  public String toString() {
    if (mUriString != null) {
      return mUriString;
    }
    StringBuilder sb = new StringBuilder();
    if (mUri.getScheme() != null) {
      sb.append(mUri.getScheme());
      sb.append("://");
    }
    if (hasAuthority()) {
      if (mUri.getScheme() == null) {
        sb.append("//");
      }
      sb.append(mUri.getAuthority().toString());
    }
    if (mUri.getPath() != null) {
      String path = mUri.getPath();
      if (path.indexOf('/') == 0 && hasWindowsDrive(path, true) // has windows drive
          && mUri.getScheme() == null // but no scheme
          && (mUri.getAuthority() == null
              || mUri.getAuthority() instanceof NoAuthority)) { // or authority
        path = path.substring(1); // remove slash before drive
      }
      sb.append(path);
    }
    if (mUri.getQuery() != null) {
      sb.append("?");
      sb.append(mUri.getQuery());
    }
    mUriString = sb.toString();
    return mUriString;
  }
@Test
  public void constructFromComponentsTests() {
    String scheme = "alluxio";
    String authority = "127.0.0.1:90909";
    String path = "/a/../b/c.txt";
    String absPath = "/b/c.txt";

    AlluxioURI uri0 = new AlluxioURI(null, null, path);
    assertEquals(absPath, uri0.toString());

    AlluxioURI uri1 = new AlluxioURI(scheme, null, path);
    assertEquals(scheme + "://" + absPath, uri1.toString());

    AlluxioURI uri2 = new AlluxioURI(scheme, Authority.fromString(authority), path);
    assertEquals(scheme + "://" + authority + absPath, uri2.toString());

    AlluxioURI uri3 = new AlluxioURI(null, Authority.fromString(authority), path);
    assertEquals("//" + authority + absPath, uri3.toString());

    AlluxioURI uri4 = new AlluxioURI("scheme:part1", Authority.fromString(authority), path);
    assertEquals("scheme:part1://" + authority + absPath, uri4.toString());

    AlluxioURI uri5 = new AlluxioURI("scheme:part1:part2", Authority.fromString(authority), path);
    assertEquals("scheme:part1:part2://" + authority + absPath, uri5.toString());
  }