@Test
  public void testDiskRegionOverflow() {
    DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
    diskRegionProperties.setOverflow(true);
    diskRegionProperties.setOverFlowCapacity(5);
    diskRegionProperties.setDiskDirs(diskDirs);

    DiskStoreFactory diskStoreFactory = toDiskStoreFactory(diskRegionProperties);

    createDiskStoreWithSizeInBytes(diskStoreName, diskStoreFactory);

    Region<Integer, Object> region =
        createRegion(regionName, diskStoreName, false, false, false, true, 5);

    DiskRegion diskRegion = getDiskRegion(region);

    DiskRegionStats diskStats = diskRegion.getStats();
    EvictionCounters evictionCounters =
        ((InternalRegion) region).getEvictionController().getCounters();

    assertThat(diskStats).isNotNull();
    assertThat(evictionCounters).isNotNull();

    diskRegion.flushForTesting();

    assertThat(diskStats.getWrites()).isEqualTo(0);
    assertThat(diskStats.getReads()).isEqualTo(0);
    assertThat(evictionCounters.getEvictions()).isEqualTo(0);

    // Put in larger stuff until we start evicting
    int total;
    for (total = 0; evictionCounters.getEvictions() <= 0; total++) {
      int[] array = new int[250];
      array[0] = total;
      region.put(total, array);
    }

    diskRegion.flushForTesting();

    assertThat(diskStats.getWrites()).isEqualTo(1);
    assertThat(diskStats.getReads()).isEqualTo(0);
    assertThat(diskStats.getNumEntriesInVM()).isEqualTo(total - 1);
    assertThat(diskStats.getNumOverflowOnDisk()).isEqualTo(1);
    assertThat(evictionCounters.getEvictions()).isEqualTo(1);

    Object value = region.get(0);
    assertThat(value).isNotNull().isInstanceOf(int[].class);
    assertThat(((int[]) value)[0]).isEqualTo(0);

    diskRegion.flushForTesting();

    assertThat(diskStats.getWrites()).isEqualTo(2);
    assertThat(diskStats.getReads()).isEqualTo(1);
    assertThat(evictionCounters.getEvictions()).isEqualTo(2);

    for (int i = 0; i < total; i++) {
      int[] array = (int[]) region.get(i);
      assertThat(array).isNotNull().isInstanceOf(int[].class);
      assertThat(array[0]).isEqualTo(i);
    }
  }
Tests if region overflows correctly and stats are create and updated correctly.
geode-core/src/integrationTest/java/org/apache/geode/internal/cache/DiskRegionJUnitTest.java