@Test(expected = AlreadyExistsException.class)
  public void testCreateDatabaseAlreadyExists() throws Exception {
    Database database = testDatabases[0];

    // Already existing database
    client.createDatabase(database);
  }
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