CorcRecordWriter implements RecordWriter<NullWritable, Corc> { @SuppressWarnings("unchecked") @Override public void write(NullWritable key, Corc value) throws IOException { writer.write(key, value.serialize()); } CorcRecordWriter(RecordWriter<NullWritable, ?> writer); @SuppressWarnings("unchecked") @Override void write(NullWritable key, Corc value); @Override void close(Reporter reporter);  }
@SuppressWarnings("unchecked") @Test public void decoratedWriterWrite() throws IOException { CorcRecordWriter corcRecordWriter = new CorcRecordWriter(writer); NullWritable key = mock(NullWritable.class); Corc value = mock(Corc.class); Object serialized = mock(Object.class); when(value.serialize()).thenReturn(serialized); corcRecordWriter.write(key, value); verify(writer).write(key, serialized); }