@Test
  public void testAlterDatabaseNotNullableFields() throws Exception {
    Database database = getDatabaseWithAllParametersSet();
    client.createDatabase(database);
    Database originalDatabase = client.getDatabase(database.getName());
    Database newDatabase = new Database();
    newDatabase.setName("new_name");
    newDatabase.setCatalogName(DEFAULT_CATALOG_NAME);

    client.alterDatabase(originalDatabase.getName(), newDatabase);
    // The name should not be changed, so reload the db with the original name
    Database alteredDatabase = client.getDatabase(originalDatabase.getName());
    Assert.assertEquals("Database name should not change", originalDatabase.getName(),
        alteredDatabase.getName());
    Assert.assertEquals("Database description should not change", originalDatabase.getDescription(),
        alteredDatabase.getDescription());
    Assert.assertEquals("Database location should not change", originalDatabase.getLocationUri(),
        alteredDatabase.getLocationUri());
    Assert.assertEquals("Database parameters should be empty", new HashMap<String, String>(),
        alteredDatabase.getParameters());
    Assert.assertNull("Database owner should be empty", alteredDatabase.getOwnerName());
    Assert.assertEquals("Database owner type should not change", originalDatabase.getOwnerType(),
        alteredDatabase.getOwnerType());
    Assert.assertNull("Database privileges should be empty", alteredDatabase.getPrivileges());
  }
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