private PartitionedRegion createPRWithEviction(String name, int lmax,
      boolean diskSync,
      boolean persistent) {
    PartitionAttributesFactory<Object, Object> paf = new PartitionAttributesFactory<>();
    paf.setLocalMaxMemory(lmax).setRedundantCopies(0).setTotalNumBuckets(13); // set low to
                                                                              // reduce
                                                                              // logging
    Cache cache = PartitionedRegionTestHelper.createCache();
    RegionFactory<Object, Object> regionFactory = cache.createRegionFactory();
    regionFactory.setPartitionAttributes(paf.create());
    if (persistent) {
      regionFactory.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
    }
    regionFactory.setEvictionAttributes(
        EvictionAttributes.createLRUEntryAttributes(1, EvictionAction.OVERFLOW_TO_DISK));
    regionFactory.setDiskStoreName("diskstore");
    regionFactory.setDiskSynchronous(diskSync);
    regionFactory.setPartitionAttributes(paf.create());
    PartitionedRegion pr;

    assertThat(DISK_DIR.mkdir()).isTrue();
    cache.createDiskStoreFactory().setDiskDirs(new File[] {DISK_DIR}).create("diskstore");

    try {
      pr = (PartitionedRegion) regionFactory.create(name);

    } catch (RegionExistsException rex) {
      pr = (PartitionedRegion) cache.getRegion(name);
    }
    return pr;
  }
This test verifies that stats are collected properly for the SingleNode and Single
PartitionedRegion
geode-core/src/integrationTest/java/org/apache/geode/internal/cache/PartitionedRegionStatsJUnitTest.java