@Override
  public RecordReader<AvroKey<T>, NullWritable> createRecordReader(InputSplit split, TaskAttemptContext context)
      throws IOException, InterruptedException {
    Schema readerSchema = AvroJob.getInputKeySchema(context.getConfiguration());
    if (null == readerSchema) {
      LOG.warn("Reader schema was not set. Use AvroJob.setInputKeySchema() if desired.");
      LOG.info("Using a reader schema equal to the writer schema.");
    }
    return new AvroKeyRecordReader<>(readerSchema);
  }
@Test
  void createRecordReader() throws IOException, InterruptedException {
    // Set up the job configuration.
    Job job = Job.getInstance();
    AvroJob.setInputKeySchema(job, Schema.create(Schema.Type.STRING));
    Configuration conf = job.getConfiguration();

    FileSplit inputSplit = mock(FileSplit.class);
    TaskAttemptContext context = mock(TaskAttemptContext.class);
    when(context.getConfiguration()).thenReturn(conf);

    AvroKeyInputFormat inputFormat = new AvroKeyInputFormat();
    @SuppressWarnings("unchecked")
    RecordReader<AvroKey<Object>, NullWritable> recordReader = inputFormat.createRecordReader(inputSplit, context);
    assertNotNull(inputFormat);
    recordReader.close();

    verify(context).getConfiguration();
  }