@Test
  public void testAlterPartitionWithEnvironmentCtx() throws Exception {
    EnvironmentContext context = new EnvironmentContext();
    context.setProperties(new HashMap<String, String>(){
      {
        put("TestKey", "TestValue");
      }
    });

    List<List<String>> testValues = createTable4PartColsParts(client);
    List<Partition> oldParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
    Partition partition = oldParts.get(3);

    assertPartitionUnchanged(partition, testValues.get(3), PARTCOL_SCHEMA);
    makeTestChangesOnPartition(partition);

    client.alter_partition(DB_NAME, TABLE_NAME, partition, context);

    List<Partition> newParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
    partition = newParts.get(3);
    assertPartitionChanged(partition, testValues.get(3), PARTCOL_SCHEMA);
    assertPartitionsHaveCorrectValues(newParts, testValues);

    client.alter_partition(DB_NAME, TABLE_NAME, partition, new EnvironmentContext());
    client.alter_partition(DB_NAME, TABLE_NAME, partition, null);
  }
Testing alter_partition(String,String,Partition,EnvironmentContext) ->
        alter_partition_with_environment_context(String,String,Partition,EnvironmentContext).
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestAlterPartitions.java