@Test(expected = NoSuchObjectException.class)
  public void testAlterDatabaseNoSuchDatabase() throws Exception {
    Database newDatabase = new DatabaseBuilder()
        .setName("test_database_altered")
        .build(metaStore.getConf());

    client.alterDatabase("no_such_database", newDatabase);
  }
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