### Question:
HCatOutputFormat extends HCatBaseOutputFormat { public static void setOutput(Job job, OutputJobInfo outputJobInfo) throws IOException { setOutput(job.getConfiguration(), job.getCredentials(), outputJobInfo); }  static void setOutput(Job job, OutputJobInfo outputJobInfo); @SuppressWarnings("unchecked") static void setOutput(Configuration conf, Credentials credentials,
                 OutputJobInfo outputJobInfo); static void setSchema(final Job job, final HCatSchema schema); static void setSchema(final Configuration conf, final HCatSchema schema); @Override RecordWriter<WritableComparable<?>, HCatRecord> getRecordWriter(TaskAttemptContext context); @Override OutputCommitter getOutputCommitter(TaskAttemptContext context
  );  }### Answer:
@Test public void testSetOutput() throws Exception { Configuration conf = new Configuration(); Job job = Job.getInstance(conf, "test outputformat"); Map<String, String> partitionValues = new HashMap<String, String>(); partitionValues.put("colname", "p1"); OutputJobInfo info = OutputJobInfo.create(dbName, tblName, partitionValues); HCatOutputFormat.setOutput(job, info); OutputJobInfo jobInfo = HCatOutputFormat.getJobInfo(job.getConfiguration()); assertNotNull(jobInfo.getTableInfo()); assertEquals(1, jobInfo.getPartitionValues().size()); assertEquals("p1", jobInfo.getPartitionValues().get("colname")); assertEquals(1, jobInfo.getTableInfo().getDataColumns().getFields().size()); assertEquals("data_column", jobInfo.getTableInfo().getDataColumns().getFields().get(0).getName()); publishTest(job); }
@Test public void testGetTableSchema() throws Exception { Configuration conf = new Configuration(); Job job = Job.getInstance(conf, "test getTableSchema"); HCatOutputFormat.setOutput( job, OutputJobInfo.create( dbName, tblName, new HashMap<String, String>() {{put("colname", "col_value");}} ) ); HCatSchema rowSchema = HCatOutputFormat.getTableSchema(job.getConfiguration()); assertEquals("Row-schema should have exactly one column.", 1, rowSchema.getFields().size()); assertEquals("Row-schema must contain the data column.", "data_column", rowSchema.getFields().get(0).getName()); assertEquals("Data column should have been STRING type.", serdeConstants.STRING_TYPE_NAME, rowSchema.getFields().get(0).getTypeString()); HCatSchema tableSchema = HCatOutputFormat.getTableSchemaWithPartitionColumns(job.getConfiguration()); assertEquals("Table-schema should have exactly 2 columns.", 2, tableSchema.getFields().size()); assertEquals("Table-schema must contain the data column.", "data_column", tableSchema.getFields().get(0).getName()); assertEquals("Data column should have been STRING type.", serdeConstants.STRING_TYPE_NAME, tableSchema.getFields().get(0).getTypeString()); assertEquals("Table-schema must contain the partition column.", "colname", tableSchema.getFields().get(1).getName()); assertEquals("Partition column should have been STRING type.", serdeConstants.STRING_TYPE_NAME, tableSchema.getFields().get(1).getTypeString()); }