private List<Partition> buildPartitions(String dbName, String tableName,
      Map<String, String> valuesAndLocations) throws MetaException {

    List<Partition> partitions = new ArrayList<>();

    for (Map.Entry<String, String> valueAndLocation : valuesAndLocations.entrySet()) {
      Partition partition =
          buildPartition(dbName, tableName, valueAndLocation.getKey(), valueAndLocation.getValue());
      partitions.add(partition);
    }
    return partitions;
  }
Tests for creating partitions from partition spec.
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestAddPartitionsFromPartSpec.java