@Test
  public void verifyPersistentStateListenerSetIsCleanedAfterClosing() {
    DistributedLockService distributedLockService = mock(DistributedLockService.class);
    String regionPath = SEPARATOR + "region";
    DiskRegionStats diskRegionStats = mock(DiskRegionStats.class);
    PersistentMemberManager persistentMemberManager = mock(PersistentMemberManager.class);
    StartupStatus startupStatus = mock(StartupStatus.class);
    PersistentStateQueryMessageSenderFactory persistentStateQueryMessageSenderFactory =
        mock(PersistentStateQueryMessageSenderFactory.class);

    String transformedMissingPersistentId = "myId";

    PersistenceAdvisorImpl persistenceAdvisor = new PersistenceAdvisorImpl(cacheDistributionAdvisor,
        distributedLockService, persistentMemberView, regionPath, diskRegionStats,
        persistentMemberManager, startupStatus, id -> transformedMissingPersistentId,
        mock(CollectionTransformer.class), persistentStateQueryMessageSenderFactory);

    PersistentStateListener listener1 = mock(PersistentStateListener.class);
    PersistentStateListener listener2 = mock(PersistentStateListener.class);

    persistenceAdvisor.addListener(listener1);
    persistenceAdvisor.addListener(listener2);

    assertThat(persistenceAdvisor.getPersistentStateListenerSet().size()).isEqualTo(2);

    persistenceAdvisor.close();
    assertThat(persistenceAdvisor.isClosed()).isTrue();
    assertThat(persistenceAdvisor.getPersistentStateListenerSet().isEmpty()).isTrue();
  }
GEODE-5402: This test creates a scenario where a member has two versions (based on timeStamp)
of another member. The call to getMembersToWaitFor should return that we wait for neither of
them.
geode-core/src/test/java/org/apache/geode/internal/cache/persistence/PersistenceAdvisorImplTest.java