### Question:
TaskIOMetricGroup extends ProxyMetricGroup<TaskMetricGroup> { public TaskIOMetricGroup(TaskMetricGroup parent) { super(parent); this.numBytesOut = counter(MetricNames.IO_NUM_BYTES_OUT); this.numBytesInLocal = counter(MetricNames.IO_NUM_BYTES_IN_LOCAL); this.numBytesInRemote = counter(MetricNames.IO_NUM_BYTES_IN_REMOTE); this.numBytesOutRate = meter(MetricNames.IO_NUM_BYTES_OUT_RATE, new MeterView(numBytesOut, 60)); this.numBytesInRateLocal = meter(MetricNames.IO_NUM_BYTES_IN_LOCAL_RATE, new MeterView(numBytesInLocal, 60)); this.numBytesInRateRemote = meter(MetricNames.IO_NUM_BYTES_IN_REMOTE_RATE, new MeterView(numBytesInRemote, 60)); this.numRecordsIn = counter(MetricNames.IO_NUM_RECORDS_IN, new SumCounter()); this.numRecordsOut = counter(MetricNames.IO_NUM_RECORDS_OUT, new SumCounter()); this.numRecordsInRate = meter(MetricNames.IO_NUM_RECORDS_IN_RATE, new MeterView(numRecordsIn, 60)); this.numRecordsOutRate = meter(MetricNames.IO_NUM_RECORDS_OUT_RATE, new MeterView(numRecordsOut, 60)); } TaskIOMetricGroup(TaskMetricGroup parent); IOMetrics createSnapshot(); Counter getNumBytesOutCounter(); Counter getNumBytesInLocalCounter(); Counter getNumBytesInRemoteCounter(); Counter getNumRecordsInCounter(); Counter getNumRecordsOutCounter(); Meter getNumBytesInLocalRateMeter(); Meter getNumBytesInRemoteRateMeter(); Meter getNumBytesOutRateMeter(); void initializeBufferMetrics(Task task); void reuseRecordsInputCounter(Counter numRecordsInCounter); void reuseRecordsOutputCounter(Counter numRecordsOutCounter);  }### Answer:
@Test public void testTaskIOMetricGroup() { TaskMetricGroup task = UnregisteredMetricGroups.createUnregisteredTaskMetricGroup(); TaskIOMetricGroup taskIO = task.getIOMetricGroup(); assertNotNull(taskIO.getNumRecordsInCounter()); assertNotNull(taskIO.getNumRecordsOutCounter()); Counter c1 = new SimpleCounter(); c1.inc(32L); Counter c2 = new SimpleCounter(); c2.inc(64L); taskIO.reuseRecordsInputCounter(c1); taskIO.reuseRecordsOutputCounter(c2); assertEquals(32L, taskIO.getNumRecordsInCounter().getCount()); assertEquals(64L, taskIO.getNumRecordsOutCounter().getCount()); taskIO.getNumBytesInLocalCounter().inc(100L); taskIO.getNumBytesInRemoteCounter().inc(150L); taskIO.getNumBytesOutCounter().inc(250L); IOMetrics io = taskIO.createSnapshot(); assertEquals(32L, io.getNumRecordsIn()); assertEquals(64L, io.getNumRecordsOut()); assertEquals(100L, io.getNumBytesInLocal()); assertEquals(150L, io.getNumBytesInRemote()); assertEquals(250L, io.getNumBytesOut()); }