@Test
  public void testPartitionedRegionRedundancyConflict() throws Exception {
    vm0.invoke(() -> {
      Cache cache = getCache();

      PartitionAttributesFactory partitionAttributesFactory = new PartitionAttributesFactory();
      partitionAttributesFactory.setRedundantCopies(0);

      RegionFactory regionFactory = cache.createRegionFactory(PARTITION);
      regionFactory.setPartitionAttributes(partitionAttributesFactory.create());

      Region region = regionFactory.create(partitionedRegionName);

      assertThat(region).isNotNull();
      assertThat(region.isDestroyed()).isFalse();
      assertThat(cache.getRegion(partitionedRegionName)).isNotNull();
    });

    for (int i = 1; i < 4; i++) {
      final int redundancy = i;

      vm1.invoke(() -> {
        Cache cache = getCache();

        PartitionAttributesFactory partitionAttributesFactory = new PartitionAttributesFactory();
        partitionAttributesFactory.setRedundantCopies(redundancy);

        RegionFactory regionFactory = cache.createRegionFactory(PARTITION);
        regionFactory.setPartitionAttributes(partitionAttributesFactory.create());

        try (IgnoredException ie = addIgnoredException(IllegalStateException.class)) {
          assertThatThrownBy(() -> regionFactory.create(partitionedRegionName))
              .isInstanceOf(IllegalStateException.class);
        }

        assertThat(cache.getRegion(partitionedRegionName)).isNull();
      });
    }
  }
Test whether partition region creation is prevented when an instance is created that has the
incorrect redundancy
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionCreationDUnitTest.java