@Test
  public void testLRUCapacityController() throws CacheException {

    DiskRegionStats diskStats = diskRegion.getStats();
    EvictionCounters lruStats = getLRUStats(region);

    IntStream.range(0, MAX_ENTRIES).forEach((i) -> region.put(i, "value"));

    assertEquals(0, lruStats.getEvictions());
    assertEquals(0, diskStats.getWrites());
    assertEquals(0, diskStats.getReads());
    assertEquals(0, diskStats.getNumOverflowOnDisk());

    // Add a new value
    region.put(MAX_ENTRIES, "value");
    assertEquals(MAX_ENTRIES, lruStats.getCounter());
    assertEquals(1, lruStats.getEvictions());
    assertEquals(1, diskStats.getWrites());
    assertEquals(0, diskStats.getReads());
    assertEquals(1, diskStats.getNumOverflowOnDisk());
    assertEquals(MAX_ENTRIES, diskStats.getNumEntriesInVM());

    // Add another new value
    region.put(MAX_ENTRIES + 1, "value");
    assertEquals(MAX_ENTRIES, lruStats.getCounter());
    assertEquals(2, lruStats.getEvictions());
    assertEquals(2, diskStats.getWrites());
    assertEquals(0, diskStats.getReads());
    assertEquals(2, diskStats.getNumOverflowOnDisk());
    assertEquals(MAX_ENTRIES, diskStats.getNumEntriesInVM());

    // Replace a value
    region.put(MAX_ENTRIES - 1, "value");
    assertEquals(MAX_ENTRIES, lruStats.getCounter());
    assertEquals(2, lruStats.getEvictions());
    assertEquals(2, diskStats.getWrites());
    assertEquals(0, diskStats.getReads());
    assertEquals(2, diskStats.getNumOverflowOnDisk());
    assertEquals(MAX_ENTRIES, diskStats.getNumEntriesInVM());
  }
Tests disk overflow with an entry-based {@link CountLRUEviction}.
geode-core/src/integrationTest/java/org/apache/geode/cache30/DiskRegionIntegrationTest.java