private void createPartitionedRegion() throws InterruptedException {
    CountDownLatch rebalancingFinished = new CountDownLatch(1);

    ResourceObserver waitForRebalancing = new ResourceObserverAdapter() {
      @Override
      public void rebalancingOrRecoveryFinished(Region region) {
        rebalancingFinished.countDown();
      }
    };

    InternalResourceManager.setResourceObserver(waitForRebalancing);
    try {
      Cache cache = getCache();
      Region partitionedRegion = createPartitionedRegion(cache, regionName, 20, 1, totalNumBuckets);
      assertThat(rebalancingFinished.await(1, MINUTES)).isTrue();
      assertThat(partitionedRegion).isNotNull();
    } finally {
      InternalResourceManager.setResourceObserver(null);
    }
  }
This verifies the Bucket Regions on the basis of redundantCopies set in RegionAttributes.
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionHADUnitTest.java