@Test
  public void testBug40876() {
    DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
    diskRegionProperties.setRegionName(regionName);
    diskRegionProperties.setRolling(false);
    diskRegionProperties.setDiskDirs(diskDirs);
    diskRegionProperties.setPersistBackup(true);

    DiskStoreFactory diskStoreFactory = toDiskStoreFactory(diskRegionProperties);

    createDiskStoreWithSizeInBytes(diskStoreName, diskStoreFactory);

    Region<String, String> region =
        createRegion(regionName, diskStoreName, true, true, false, false, 0);

    region.put("key1", "value1");
    region.invalidate("key1");
    region.close();

    region = createRegion(regionName, diskStoreName, true, true, false, false, 0);

    Object value = ((InternalPersistentRegion) region).getValueOnDiskOrBuffer("key1");
    assertThat(value).isEqualTo(Token.INVALID);
    assertThat(region.containsValueForKey("key1")).isFalse();
  }
Regression test for TRAC #40876: diskReg tests (disk persistence and overflow-to-disk) fail
when an invalidated entry is recovered from disk
geode-core/src/integrationTest/java/org/apache/geode/internal/cache/DiskRegionJUnitTest.java