public String[] dir() throws KettleJobException {
    try {
      Vector<ChannelSftp.LsEntry> entries = channel.ls( "." );
      if ( entries == null ) {
        return null;
      }

      List<String> files = entries.stream()
        .filter( lse -> lse != null && !lse.getAttrs().isDir() )
        .map( ChannelSftp.LsEntry::getFilename )
        .collect( Collectors.toList() );

      // uses depend on being null when empty
      return files.isEmpty() ? null : files.toArray( new String[ files.size() ] );

    } catch ( SftpException e ) {
      throw new KettleJobException( e );
    }
  }
@Test
  public void testDir() throws Exception {
    Vector<ChannelSftp.LsEntry> files = new Vector<>();
    files.add( mockLsEntry("file_1", false ) );
    files.add( mockLsEntry("a_dir", true ) );

    when( channel.ls( anyString() ) ).thenReturn( files );

    SFTPClient client = spyClient();
    client.login( password );

    String[] dirs = client.dir();

    assertEquals( 1, dirs.length );
    assertEquals( "file_1", dirs[0] );
  }