@Before
  public void setUp() throws Exception {
    HiveMetaStoreClient.setProcessorIdentifier("UnitTest@TestDatabases");
    HiveMetaStoreClient.setProcessorCapabilities(new String[] {
        "HIVEFULLACIDREAD",
        "EXTWRITE",
        "EXTREAD",
        "HIVEBUCKET2"
    } );

    // Get new client
    client = metaStore.getClient();

    // Clean up the databases
    for(String databaseName : client.getAllDatabases()) {
      if (!databaseName.equals(DEFAULT_DATABASE)) {
        client.dropDatabase(databaseName, true, true, true);
      }
    }

    testDatabases[0] =
        new DatabaseBuilder().setName("test_database_1").create(client, metaStore.getConf());
    testDatabases[1] =
        new DatabaseBuilder().setName("test_database_to_find_1").create(client, metaStore.getConf());
    testDatabases[2] =
        new DatabaseBuilder().setName("test_database_to_find_2").create(client, metaStore.getConf());
    testDatabases[3] =
        new DatabaseBuilder().setName("test_database_hidden_1").create(client, metaStore.getConf());

    // Create the databases, and reload them from the MetaStore
    for (int i=0; i < testDatabases.length; i++) {
      testDatabases[i] = client.getDatabase(testDatabases[i].getName());
    }
  }
Test class for IMetaStoreClient API. Testing the Database related functions.
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestDatabases.java