@Test
  public void twoLocatorPartitionDoesntSplitBrain() throws Exception {

    // Begin setting up preconditions...
    initMocks(true);

    // We'll have a two-member view. We'll test from the perspective of the coordinator,
    // so gmsJoinLeave/gmsJoinLeaveMemberId refers to the coordinator. And we'll use one
    // of the mock members to be the other (non-coordinator) member.
    final MemberIdentifier nonCoordinator = mockMembers[0];

    // Make the members have equal weight, as would be the case for two locators. This is
    // a very common situation during cluster startup. It's also possible during crash and
    // scaling scenarios.
    gmsJoinLeaveMemberId.setVmKind(MemberIdentifier.LOCATOR_DM_TYPE);
    nonCoordinator.setVmKind(MemberIdentifier.LOCATOR_DM_TYPE);

    becomeCoordinatorForTest(gmsJoinLeave);
    await().until(() -> gmsJoinLeave.isCoordinator());

    messengerAckAllInstallViewMessages();

    gmsJoinLeave.processJoinRequestMessage(
        new JoinRequestMessage(gmsJoinLeaveMemberId, nonCoordinator, null, 1, 1));
    await().until(() -> gmsJoinLeave.currentView.contains(nonCoordinator));

    // Coordinator receives a RemoveMemberMessage about the other member
    final Set<MemberIdentifier> crashes = Collections.singleton(nonCoordinator);
    final List<MemberIdentifier> members = Collections.singletonList(gmsJoinLeaveMemberId);

    final GMSMembershipView prePartitionView = gmsJoinLeave.getView();

    final GMSMembershipView partitionView =
        new GMSMembershipView(
            gmsJoinLeaveMemberId,
            gmsJoinLeave.getView().getViewId() + 1,
            members,
            Collections.emptySet(),
            crashes);

    // This method (and methods it calls), is what we're testing here:
    gmsJoinLeave.getViewCreator().prepareAndSendView(
        partitionView, Collections.emptyList(), Collections.emptySet(), crashes);

    verify(manager).forceDisconnect(isA(String.class));
    verify(manager).quorumLost(crashes, prePartitionView);
  }
Given a view with [A, B, C, D] where C is coordinator, a failed availability check on A
and a pending join request from E show that B becomes coordinator when C sends it a
Leave request and that E is allowed into the system and retains its view ID.
See GEODE-6570
geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeaveJUnitTest.java