@Test
  public void testAddListener() {
    TestStatisticsMonitor monitor = new TestStatisticsMonitor();
    assertTrue(monitor.getStatisticsListenersSnapshot().isEmpty());
    StatisticsListener listener = notification -> {
    };

    assertNull(sampleCollector.getStatMonitorHandlerSnapshot());

    monitor.addListener(listener);

    assertFalse(monitor.getStatisticsListenersSnapshot().isEmpty());
    assertTrue(monitor.getStatisticsListenersSnapshot().contains(listener));
    assertEquals(1, monitor.getStatisticsListenersSnapshot().size());

    assertNotNull(sampleCollector.getStatMonitorHandlerSnapshot());
    assertFalse(
        sampleCollector.getStatMonitorHandlerSnapshot().getMonitorsSnapshot().isEmpty());
  }
Unit tests for the StatisticsMonitor class. No disk IO.

@since GemFire 7.0
geode-core/src/test/java/org/apache/geode/internal/statistics/StatisticsMonitorTest.java