@Test
  public void testGetDatabases() throws Exception {
    // Find databases which name contains _to_find_
    List<String> databases = client.getDatabases("*_to_find_*");
    Assert.assertEquals("Found databases size", 2, databases.size());
    Assert.assertTrue("Should contain", databases.contains("test_database_to_find_1"));
    Assert.assertTrue("Should contain", databases.contains("test_database_to_find_2"));

    // Find databases which name contains _to_find_ or _hidden_
    databases = client.getDatabases("*_to_find_*|*_hidden_*");
    Assert.assertEquals("Found databases size", 3, databases.size());
    Assert.assertTrue("Should contain", databases.contains("test_database_to_find_1"));
    Assert.assertTrue("Should contain", databases.contains("test_database_to_find_2"));
    Assert.assertTrue("Should contain", databases.contains("test_database_hidden_1"));

    // Look for databases but do not find any
    databases = client.getDatabases("*_not_such_database_*");
    Assert.assertEquals("No such databases size", 0, databases.size());

    // Look for databases without pattern
    databases = client.getDatabases(null);
    Assert.assertEquals("Search databases without pattern size", 5, databases.size());
  }
This test creates and queries a database and then drops it. Good for testing the happy path.
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestDatabases.java