void activate(long newNextWriteOffset) {
        if (active()) {
            throw new RuntimeException("Can't activate already active OffsetControlManager.");
        }
        if (newNextWriteOffset < 0) {
            throw new RuntimeException("Invalid negative newNextWriteOffset " +
                    newNextWriteOffset + ".");
        }
        // Before switching to active, create an in-memory snapshot at the last committed
        // offset. This is required because the active controller assumes that there is always
        // an in-memory snapshot at the last committed offset.
        snapshotRegistry.idempotentCreateSnapshot(lastStableOffset);
        this.nextWriteOffset = newNextWriteOffset;
        metrics.setActive(true);
    }
@Test
    public void testActivate() {
        OffsetControlManager offsetControl = new OffsetControlManager.Builder().build();
        offsetControl.activate(1000L);
        assertEquals(1000L, offsetControl.nextWriteOffset());
        assertTrue(offsetControl.active());
        assertTrue(offsetControl.metrics().active());
        assertEquals(Collections.singletonList(-1L), offsetControl.snapshotRegistry().epochsList());
    }