public List<File> getFiles( File file, String filters, boolean useCache ) throws FileException {
    try {
      FileProvider<File> fileProvider = providerService.get( file.getProvider() );
      List<File> files;
      if ( fileCache.containsKey( file ) && useCache ) {
        files = fileCache.getFiles( file ).stream()
          .filter( f -> f instanceof Directory
            || ( f instanceof RepositoryFile && ( (RepositoryFile) f ).passesTypeFilter( filters ) )
            || org.pentaho.di.plugins.fileopensave.api.providers.Utils.matches( f.getName(), filters ) )
          .collect( Collectors.toList() );
      } else {
        files = fileProvider.getFiles( file, filters, space );
        fileCache.setFiles( file, files );
      }

      fileListener.ifPresent( listener -> files.stream().map( this::toLookupInfo ).forEach( listener::onFileLoaded ) );
      return files;

    } catch ( InvalidFileProviderException e ) {
      return Collections.emptyList();
    }
  }
@Test
  public void testGetFilesCache() throws FileException {
    TestDirectory testDirectory = new TestDirectory();
    testDirectory.setPath( "/" );
    List<File> files = fileController.getFiles( testDirectory, null, true );
    Assert.assertEquals( 8, files.size() );

    Assert.assertTrue( fileController.fileCache.containsKey( testDirectory ) );
    Assert.assertEquals( 8, fileController.fileCache.getFiles( testDirectory ).size() );
  }