@Test
  public void testMemberJoinsAfterNewViewIsInstalled() {
    vm1.invoke("join the cluster", () -> getSystem().getDistributedMember());
    vm1.invoke(
        () -> system.getDistributionManager().addMembershipListener(new MembershipListener() {
          @Override
          public void memberJoined(DistributionManager distributionManager,
              InternalDistributedMember id) {
            if (!distributionManager.getDistribution().getMembership().memberExists(id)) {
              // if MemberJoinedEvent is triggered before the new view is installed,
              // the test will throw an exception
              FunctionService.onMember(id)
                  .execute(new FailDeserializationFunction());
            }
          }
        }));
    // trigger MemberJoinedEvent
    DistributedMember member =
        vm2.invoke("join the cluster", () -> getSystem().getDistributedMember());
    assertThat(member).isNotNull();
  }
show that waitForViewInstallation works as expected when distribution manager is closed
while waiting for the latest membership view to install
geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/ClusterDistributionManagerDUnitTest.java