@Test
  public void testFailedWeight() throws Exception {
    // in #47342 a new view was created that contained a member that was joining but
    // was no longer reachable. The member was included in the failed-weight and not
    // in the previous view-weight, causing a spurious network partition to be declared
    MemberIdentifier[] members =
        new MemberIdentifier[] {
            createMemberID(1),
            createMemberID(2),
            createMemberID(3),
            createMemberID(4),
            createMemberID(5),
            createMemberID(6)};
    int i = 0;
    // weight 3
    members[i].setVmKind(MemberIdentifier.LOCATOR_DM_TYPE);
    members[i++].setPreferredForCoordinator(true);
    // weight 3
    members[i].setVmKind(MemberIdentifier.LOCATOR_DM_TYPE);
    members[i++].setPreferredForCoordinator(true);
    // weight 15 (cache+leader)
    members[i].setVmKind(MemberIdentifier.NORMAL_DM_TYPE);
    members[i++].setPreferredForCoordinator(false);
    // weight 0
    members[i].setVmKind(MemberIdentifier.ADMIN_ONLY_DM_TYPE);
    members[i++].setPreferredForCoordinator(false);
    // weight 0
    members[i].setVmKind(MemberIdentifier.ADMIN_ONLY_DM_TYPE);
    members[i++].setPreferredForCoordinator(false);
    // weight 10
    members[i].setVmKind(MemberIdentifier.NORMAL_DM_TYPE);
    members[i++].setPreferredForCoordinator(false);

    List<MemberIdentifier> vmbrs = new ArrayList<>(members.length);
    for (i = 0; i < members.length; i++) {
      vmbrs.add(members[i]);
    }
    GMSMembershipView lastView =
        new GMSMembershipView(members[0], 4,
            vmbrs);
    MemberIdentifier leader = members[2];
    assertTrue(!leader.preferredForCoordinator());

    MemberIdentifier joiningMember = createMemberID(7);
    joiningMember.setVmKind(MemberIdentifier.NORMAL_DM_TYPE);
    joiningMember.setPreferredForCoordinator(false);

    // have the joining member and another cache process (weight 10) in the failed members
    // collection and check to make sure that the joining member is not included in failed
    // weight calcs.
    Set<MemberIdentifier> failedMembers = new HashSet<>(3);
    failedMembers.add(joiningMember);
    failedMembers.add(members[members.length - 1]); // cache
    failedMembers.add(members[members.length - 2]); // admin
    List<MemberIdentifier> newMbrs =
        new ArrayList<>(lastView.getGMSMembers());
    newMbrs.removeAll(failedMembers);
    GMSMembershipView newView =
        new GMSMembershipView(members[0], 5, newMbrs,
            Collections.emptySet(), failedMembers);

    int failedWeight = newView.getCrashedMemberWeight(lastView);
    // System.out.println("last view = " + lastView);
    // System.out.println("failed mbrs = " + failedMembers);
    // System.out.println("failed weight = " + failedWeight);
    assertEquals("failure weight calculation is incorrect", 10, failedWeight);
    Set<MemberIdentifier> actual = newView.getActualCrashedMembers(lastView);
    assertTrue(!actual.contains(members[members.length - 2]));
  }
Test that failed weight calculations are correctly performed. See bug #47342
geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/GMSMembershipViewJUnitTest.java