void handleCommitBatch(Batch<ApiMessageAndVersion> batch) {
        this.lastCommittedOffset = batch.lastOffset();
        this.lastCommittedEpoch = batch.epoch();
        maybeAdvanceLastStableOffset();
        metrics.setLastCommittedRecordOffset(batch.lastOffset());
        if (!active()) {
            // On standby controllers, the last applied record offset is equals to the last
            // committed offset.
            metrics.setLastAppliedRecordOffset(batch.lastOffset());
            metrics.setLastAppliedRecordTimestamp(batch.appendTimestamp());
        }
    }
@Test
    public void testHandleCommitBatch() {
        OffsetControlManager offsetControl = new OffsetControlManager.Builder().build();

        offsetControl.handleCommitBatch(newFakeBatch(1000L, 200, 3000L));
        assertEquals(Collections.singletonList(1000L), offsetControl.snapshotRegistry().epochsList());
        assertEquals(1000L, offsetControl.lastCommittedOffset());
        assertEquals(200, offsetControl.lastCommittedEpoch());
        assertEquals(1000L, offsetControl.lastStableOffset());
        assertEquals(-1L, offsetControl.transactionStartOffset());
        assertEquals(-1L, offsetControl.nextWriteOffset());
        assertFalse(offsetControl.active());
        assertFalse(offsetControl.metrics().active());
        assertEquals(1000L, offsetControl.metrics().lastAppliedRecordOffset());
        assertEquals(1000L, offsetControl.metrics().lastCommittedRecordOffset());
        assertEquals(3000L, offsetControl.metrics().lastAppliedRecordTimestamp());
    }