@SuppressWarnings( "unchecked" )
  @Nullable
  public <T extends VFSConnectionDetails> VFSConnectionProvider<T> getProvider(
    @NonNull ConnectionManager manager,
    @Nullable String key ) {
    return (VFSConnectionProvider<T>) manager.getConnectionProvider( key );
  }
@Test
  public void testGetProviderOfDetailsReturnsExistingCastedProviderFromManager() {
    String provider1Key = "provider1Key";

    VFSConnectionDetails details1 = mock( VFSConnectionDetails.class );
    doReturn( provider1Key ).when( details1 ).getType();

    ConnectionProvider<? extends ConnectionDetails> provider1 =
      (ConnectionProvider<? extends ConnectionDetails>) mock( VFSConnectionProvider.class );

    doReturn( provider1 ).when( connectionManager ).getConnectionProvider( provider1Key );

    VFSConnectionProvider<VFSConnectionDetails> result =
      vfsConnectionManagerHelper.getProvider( connectionManager, details1 );

    assertSame( provider1, result );
  }