### Question:
HiveObjectUtils { public static String getParameter(Table table, String parameter) { return getParameter(table.getParameters(), table.getSd().getSerdeInfo().getParameters(), parameter); } private  HiveObjectUtils(); static String getParameter(Table table, String parameter); static String getParameter(Partition partition, String parameter); static Table updateSerDeUrl(Table table, String parameter, String url); static Partition updateSerDeUrl(Partition partition, String parameter, String url);  }### Answer:
@Test public void getParameterFromTablesTableProperties() { Table table = newTable(); table.getParameters().put(AVRO_SCHEMA_URL_PARAMETER, "test"); assertThat(HiveObjectUtils.getParameter(table, AVRO_SCHEMA_URL_PARAMETER), is("test")); }
@Test public void getParameterFromTablesSerDeProperties() { Table table = newTable(); table.getSd().getSerdeInfo().getParameters().put(AVRO_SCHEMA_URL_PARAMETER, "test"); assertThat(HiveObjectUtils.getParameter(table, AVRO_SCHEMA_URL_PARAMETER), is("test")); }
@Test public void getParameterFromTableWhichIsntSetReturnsNull() { Table table = newTable(); assertThat(HiveObjectUtils.getParameter(table, AVRO_SCHEMA_URL_PARAMETER), is(nullValue())); }
@Test public void getParameterFromTablePropertiesWhenSerDePropertiesAreAlsoSetInTable() { Table table = newTable(); table.getParameters().put(AVRO_SCHEMA_URL_PARAMETER, "test"); table.getSd().getSerdeInfo().getParameters().put(AVRO_SCHEMA_URL_PARAMETER, "foo"); assertThat(HiveObjectUtils.getParameter(table, AVRO_SCHEMA_URL_PARAMETER), is("test")); }
@Test public void getParameterFromPartitionsTableProperties() { Partition partition = newPartition(); partition.getParameters().put(AVRO_SCHEMA_URL_PARAMETER, "test"); assertThat(HiveObjectUtils.getParameter(partition, AVRO_SCHEMA_URL_PARAMETER), is("test")); }
@Test public void getParameterFromPartitionsSerDeProperties() { Partition partition = newPartition(); partition.getSd().getSerdeInfo().getParameters().put(AVRO_SCHEMA_URL_PARAMETER, "test"); assertThat(HiveObjectUtils.getParameter(partition, AVRO_SCHEMA_URL_PARAMETER), is("test")); }
@Test public void getParameterFromTablePropertiesWhenSerDePropertiesAreAlsoSetInPartition() { Partition partition = newPartition(); partition.getParameters().put(AVRO_SCHEMA_URL_PARAMETER, "test"); partition.getSd().getSerdeInfo().getParameters().put(AVRO_SCHEMA_URL_PARAMETER, "foo"); assertThat(HiveObjectUtils.getParameter(partition, AVRO_SCHEMA_URL_PARAMETER), is("test")); }
@Test public void getParameterFromPartitionWhichIsntSetReturnsNull() { Partition partition = newPartition(); assertTrue(HiveObjectUtils.getParameter(partition, AVRO_SCHEMA_URL_PARAMETER) == null); }