@Test
  public void testCreateGetDeleteTable() throws Exception {
    // Try to create a table with all of the parameters set
    Table table = getTableWithAllParametersSet();
    client.createTable(table);
    table.unsetId();

    Table createdTable = client.getTable(table.getDbName(), table.getTableName());
    // The createTime will be set on the server side, so the comparison should skip it
    table.setCreateTime(createdTable.getCreateTime());
    // The extra parameters will be added on server side, so check that the required ones are
    // present
    for(String key: table.getParameters().keySet()) {
      Assert.assertEquals("parameters are the same",
          table.getParameters().get(key), createdTable.getParameters().get(key));
    }
    // Reset the parameters, so we can compare
    table.setParameters(createdTable.getParameters());
    table.setCreationMetadata(createdTable.getCreationMetadata());
    table.setWriteId(createdTable.getWriteId());

    Assert.assertTrue(createdTable.isSetId());
    createdTable.unsetId();
    Assert.assertEquals("create/get table data", table, createdTable);

    client.dropTable(table.getDbName(), table.getTableName(), true, false);
    try {
      client.getTable(table.getDbName(), table.getTableName());
      Assert.fail("Expected a NoSuchObjectException to be thrown");
    } catch (NoSuchObjectException exception) {
      // Expected exception
    }
  }
This test creates and queries a table and then drops it. Good for testing the happy path
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestTablesCreateDropAlterTruncate.java