@Test
  public void testStopCancelsTimersBeforeTrigger() throws InterruptedException {
    // Arrange
    AtomicBoolean handlerCalled = new AtomicBoolean(false);
    BootstrapSession session = new BootstrapSession(mockPartitionId, "snapshot1", "node1",
        diskManagerConfig, (nodeId, partitionId) -> handlerCalled.set(true), (nodeId, partitionId) -> handlerCalled.set(true));

    // Act
    session.start();
    session.stop();
    Thread.sleep(150); // The default timer in test context is configured to be 300ms. Let time pass, timers shouldn't fire.

    // Assert
    assertFalse("Timer handler should not have been called after stop()", handlerCalled.get());
  }
Test that {@link BootstrapSession#stop} cancels the timers before they trigger.
ambry-store/src/test/java/com/github/ambry/store/BootstrapSessionTest.java