@Test
  public void testCreateGetDeleteDatabase() throws Exception {
    Database database = getDatabaseWithAllParametersSet();
    client.createDatabase(database);
    Database createdDatabase = client.getDatabase(database.getName());

    // The createTime will be set on the server side, so the comparison should skip it
    database.setCreateTime(createdDatabase.getCreateTime());
    Assert.assertEquals("Comparing databases", database, createdDatabase);
    Assert.assertTrue("The directory should be created", metaStore.isPathExists(
        new Path(database.getLocationUri())));
    client.dropDatabase(database.getName());
    Assert.assertFalse("The directory should be removed",
        metaStore.isPathExists(new Path(database.getLocationUri())));
    try {
      client.getDatabase(database.getName());
      Assert.fail("Expected a NoSuchObjectException to be thrown");
    } catch (NoSuchObjectException exception) {
      // Expected exception
    }
  }
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