@NonNull
  @Override
  public FileName toProviderFileName( @NonNull ConnectionFileName pvfsFileName, @NonNull T details )
    throws KettleException {

    StringBuilder providerUriBuilder = new StringBuilder();

    appendProviderUriConnectionRoot( providerUriBuilder, details );

    // Examples:
    //  providerUriBuilder: "hcp://domain.my:443/root/path" | "local:///C:/root/path" | "s3://"
    //  getPath():          "/folder/sub-folder" | "/"

    appendProviderUriRestPath( providerUriBuilder, pvfsFileName.getPath(), details );

    // Examples: "hcp://domain.my:443/root/path/folder/sub-folder" | "s3://folder/sub-folder"

    // Preserve file type information.
    if ( pvfsFileName.getType().hasChildren() ) {
      providerUriBuilder.append( SEPARATOR );
    }

    return parseUri( providerUriBuilder.toString() );
  }
@Test
  public void testToProviderFileNameHandlesFolders() throws Exception {

    ConnectionFileName pvfsFileName = mockPvfsFileNameWithPath( "/rest/path/" );

    FileName providerFileName = transformer.toProviderFileName( pvfsFileName, details1 );

    assertEquals( "scheme1://rest/path", providerFileName.getURI() );
    assertFalse( providerFileName.isFile() );

    // Should do provider uri normalization.
    verify( kettleVFS, times( 1 ) ).resolveURI( any() );
  }