@Override
  protected Table createTestTable(IMetaStoreClient client, String dbName, String tableName,
      List<String> partCols, boolean setPartitionLevelPrivilages)
      throws Exception {
    TableBuilder builder = new TableBuilder()
        .setDbName(dbName)
        .setTableName(tableName)
        .addCol("id", "int")
        .addCol("name", "string")
        .setTemporary(true);

    partCols.forEach(col -> builder.addPartCol(col, "string"));
    Table table = builder.build(getMetaStore().getConf());

    if (setPartitionLevelPrivilages) {
      table.putToParameters(PART_PRIV, "true");
    }

    client.createTable(table);
    return table;
  }
Test class for alter/rename partitions related methods on temporary tables.
ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientAlterPartitionsTempTable.java