static S3ResourceId fromUri(String uri) {
    Matcher m = S3_URI.matcher(uri);
    checkArgument(m.matches(), "Invalid S3 URI: [%s]", uri);
    String scheme = m.group("SCHEME");
    String bucket = m.group("BUCKET");
    String key = Strings.nullToEmpty(m.group("KEY"));
    if (!key.startsWith("/")) {
      key = "/" + key;
    }
    return fromComponents(scheme, bucket, key);
  }
@Test
  public void testInvalidPathNoBucket() {
    assertThrows(
        "Invalid S3 URI: [s3://]",
        IllegalArgumentException.class,
        () -> S3ResourceId.fromUri("s3://"));
  }