@Test(expected = MetaException.class)
  public void testAddPartitionSpecNullPart() throws Exception {

    createTable();
    List<Partition> partitions = new ArrayList<>();
    Partition partition1 = buildPartition(DB_NAME, TABLE_NAME, DEFAULT_YEAR_VALUE);
    Partition partition2 = null;
    partitions.add(partition1);
    partitions.add(partition2);
    PartitionSpecProxy partitionSpecProxy =
        buildPartitionSpec(DB_NAME, TABLE_NAME, null, partitions);
    client.add_partitions_pspec(partitionSpecProxy);
  }
Tests for creating partitions from partition spec.
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestAddPartitionsFromPartSpec.java