// Configure a mock task attempt context.
Job job = new Job(conf);
job.getConfiguration().set("mapred.output.dir", mTempDir.getRoot().getPath());
Schema writerSchema = Schema.create(Schema.Type.INT);
AvroJob.setOutputKeySchema(job, writerSchema);
TaskAttemptContext context = createMock(TaskAttemptContext.class);
expect(context.getConfiguration())
.andReturn(job.getConfiguration()).anyTimes();
expect(context.getTaskAttemptID())
.andReturn(new TaskAttemptID("id", 1, true, 1, 1))
.anyTimes();
// Create a mock record writer.
@SuppressWarnings("unchecked")