public static void getTables( DatabaseMeta databaseMeta, String schema, Consumer<String[]> tablesConsumer ) {
    executeAction( databaseMeta, database -> {
      try {
        tablesConsumer.accept( database.getTablenames( schema, false ) );
      } catch ( KettleDatabaseException | NullPointerException e ) {
        logError( databaseMeta, e );
        tablesConsumer.accept( new String[ 0 ] );
      }
    } );
  }
@Test
  public void getTables() throws InterruptedException, ExecutionException, TimeoutException {
    AsyncDatabaseAction.getTables( dbMeta, "PUBLIC", completion::complete );
    String[] tables = completion.get( COMPLETION_TIMEOUT, TimeUnit.MILLISECONDS );
    assertThat( tables.length, equalTo( 3 ) );
    assertThat( sorted( tables ), equalTo( new String[] { "BAR", "BAZ", "FOO" } ) );
  }