@Test
  public void appropriateOverredundantBucketsRemovedDuringRebalance() throws UnknownHostException {

    InternalDistributedMember member1 =
        new InternalDistributedMember(InetAddress.getByName("127.0.0.1"), 1);
    InternalDistributedMember member2 =
        new InternalDistributedMember(InetAddress.getByName("127.0.0.1"), 2);
    // Create some imbalanced nodes
    PartitionMemberInfoImpl details1 =
        buildDetails(member1, new long[] {1, 1, 1, 1}, new long[] {0, 1, 1, 0});
    PartitionMemberInfoImpl details2 =
        buildDetails(member2, new long[] {1, 1, 1, 1}, new long[] {1, 0, 0, 1});

    PartitionedRegionLoadModel model = new PartitionedRegionLoadModel(bucketOperator, 0, 4,
        getAddressComparor(false), Collections.emptySet(), partitionedRegion);
    model.addRegion("a", Arrays.asList(details1, details2), new FakeOfflineDetails(), true);

    assertThat(doMoves(new CompositeDirector(true, true, true, true), model)).isEqualTo(4);

    assertThat(bucketOperator.creates).isEqualTo(Collections.emptyList());
    assertThat(bucketOperator.primaryMoves).isEqualTo(Collections.emptyList());
    assertThat(bucketOperator.bucketMoves).isEqualTo(Collections.emptyList());

    // We should see 4 buckets deleted.
    List<Remove> expectedRemoves = new ArrayList<>();
    expectedRemoves.add(new Remove(member1, 0));
    expectedRemoves.add(new Remove(member2, 1));
    expectedRemoves.add(new Remove(member2, 2));
    expectedRemoves.add(new Remove(member1, 3));

    assertThat(bucketOperator.removes).isEqualTo(expectedRemoves);
  }
Setup:
two full copies of the data with proper primaries and validate that when redundancy
is 0 that extra copies are removed.
geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/rebalance/PartitionedRegionLoadModelJUnitTest.java