@Test
  public void testGetTables() throws Exception {
    // Find tables which name contains _to_find_ in the default database
    List<String> tables = client.getTables(DEFAULT_DATABASE, "*_to_find_*");
    Assert.assertEquals("All tables size", 2, tables.size());
    Assert.assertTrue("Comparing tablenames", tables.contains(testTables[2].getTableName()));
    Assert.assertTrue("Comparing tablenames", tables.contains(testTables[3].getTableName()));

    // Find tables which name contains _to_find_ or _hidden_ in the default database
    tables = client.getTables(DEFAULT_DATABASE, "*_to_find_*|*_hidden_*");
    Assert.assertEquals("All tables size", 3, tables.size());
    Assert.assertTrue("Comparing tablenames", tables.contains(testTables[2].getTableName()));
    Assert.assertTrue("Comparing tablenames", tables.contains(testTables[3].getTableName()));
    Assert.assertTrue("Comparing tablenames", tables.contains(testTables[4].getTableName()));

    // Find table which name contains _to_find_ in the dummy database
    tables = client.getTables(OTHER_DATABASE, "*_to_find_*");
    Assert.assertEquals("Found functions size", 1, tables.size());
    Assert.assertTrue("Comparing tablenames", tables.contains(testTables[6].getTableName()));

    // Find tables by using the wildcard sign "*"
    tables = client.getTables(DEFAULT_DATABASE, "*");
    Assert.assertEquals("All tables size", 5, tables.size());
    Assert.assertTrue("Comparing tablenames", tables.contains(testTables[0].getTableName()));
    Assert.assertTrue("Comparing tablenames", tables.contains(testTables[1].getTableName()));
    Assert.assertTrue("Comparing tablenames", tables.contains(testTables[2].getTableName()));
    Assert.assertTrue("Comparing tablenames", tables.contains(testTables[3].getTableName()));
    Assert.assertTrue("Comparing tablenames", tables.contains(testTables[4].getTableName()));

    tables = client.getTables(OTHER_DATABASE, "*");
    Assert.assertEquals("All tables size", 2, tables.size());
    Assert.assertTrue("Comparing tablenames", tables.contains(testTables[5].getTableName()));
    Assert.assertTrue("Comparing tablenames", tables.contains(testTables[6].getTableName()));

    // Look for tables but do not find any
    tables = client.getTables(DEFAULT_DATABASE, "*_not_such_function_*");
    Assert.assertEquals("No such table size", 0, tables.size());

    // Look for tables without pattern
    tables = client.getTables(DEFAULT_DATABASE, (String)null);
    Assert.assertEquals("No such functions size", 5, tables.size());

    // Look for tables with empty pattern
    tables = client.getTables(DEFAULT_DATABASE, "");
    Assert.assertEquals("No such functions size", 0, tables.size());

    // No such database
    try {
      tables = client.getTables("no_such_database", OTHER_DATABASE);
    }catch (MetaException exception) {
      // Ignoring Expected exception
    }
  }
Test class for IMetaStoreClient API. Testing the Table related functions for metadata
querying like getting one, or multiple tables, and table name lists.
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestTablesGetExists.java