@Test
  public void testCreateTableRooPathLocationInSpecificDatabase() {
    Table table = new Table();
    StorageDescriptor sd = new StorageDescriptor();
    List<FieldSchema> cols = new ArrayList<>();
    sd.setLocation("hdfs://localhost:8020");
    table.setDbName(DEFAULT_DATABASE);
    table.setTableName("test_table_2_with_root_path");
    cols.add(new FieldSchema("column_name", "int", null));
    sd.setCols(cols);
    sd.setSerdeInfo(new SerDeInfo());
    table.setSd(sd);

    Exception exception = assertThrows(InvalidObjectException.class, () -> client.createTable(table));
    Assert.assertEquals("Storage descriptor location",
            table.getTableName() + " location must not be root path",
            exception.getMessage());
  }
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