AvroMultipleOutputs { public void close() throws IOException, InterruptedException { for (@SuppressWarnings("rawtypes") RecordWriter writer : recordWriters.values()) { writer.close(context); } } AvroMultipleOutputs(
      TaskInputOutputContext<?, ?, ?, ?> context); @SuppressWarnings("rawtypes") static void addNamedOutput(Job job, String namedOutput,
      Class<? extends OutputFormat> outputFormatClass,
      Schema keySchema); @SuppressWarnings("rawtypes") static void addNamedOutput(Job job, String namedOutput,
      Class<? extends OutputFormat> outputFormatClass,
      Schema keySchema, Schema valueSchema); static void setCountersEnabled(Job job, boolean enabled); static boolean getCountersEnabled(JobContext job); Set<String> getNamedOutputs(); void write(String namedOutput, Object key); void write(String namedOutput, Object key, Object value); @SuppressWarnings("unchecked") void write(String namedOutput, Object key, Object value,
      String baseOutputPath); void write(Object key, Object value, String baseOutputPath); @SuppressWarnings({ "unchecked", "deprecation" }) void write(Object key, Object value, Schema keySchema,
      Schema valSchema, String baseOutputPath); @SuppressWarnings("rawtypes") synchronized RecordWriter getRecordWriter(
      TaskAttemptContext taskContext, String baseFileName); @SuppressWarnings("deprecation") TaskAttemptContext getContext(String nameOutput); void close();  }
@Test public void testClose() throws Exception { String baseFileName = "baseFileName"; Configuration conf = new Configuration(); doReturn(conf).when(context).getConfiguration(); doReturn(outputFormatClass).when(context).getOutputFormatClass(); doReturn(MockOutputFormat.class).when(context).getOutputFormatClass(); AvroMultipleOutputs multipleOutputs = new AvroMultipleOutputs(context); RecordWriter<?, ?> recordWriter = multipleOutputs.getRecordWriter(context, baseFileName); multipleOutputs.close(); assertTrue(recordWriter instanceof MockRecordWriter); assertTrue(((MockRecordWriter)recordWriter).isClosed()); }