private void checkEntriesInMemory(Region r, int start, int end, Object invalid,
      boolean inMemory) {
    LocalRegion region = (LocalRegion) r;
    for (int i = start; i < end; i++) {
      Object inMemoryValue = region.getValueInVM(i);
      if (inMemory) {
        if (inMemoryValue instanceof VMCachedDeserializable) {
          inMemoryValue = ((VMCachedDeserializable) inMemoryValue).getDeserializedForReading();
        }
        assertEquals("Failed on entry " + i, invalid, inMemoryValue);
      } else {
        assertEquals("Failed on entry " + i, null, inMemoryValue);
      }
    }
  }
Validate that values are, or are not, in memory
geode-core/src/integrationTest/java/org/apache/geode/internal/cache/DiskRegionAsyncRecoveryJUnitTest.java