verify(instance, never()).getTopic(anyString()); // Ensure a topic is not requested
verify(config, atLeastOnce()).findMapConfig(eq(REGION_NAME));
verify(mapConfig, times(2)).getTimeToLiveSeconds(); // Should have been retrieved by the region itself
// Next, load the cache with more entries than the configured max size
LocalRegionCache regionCache = region.getCache();
assertNotNull(regionCache);
int oversized = maxSize * 2;
for (int i = 0; i < oversized; ++i) {
regionCache.put(i, i, i);
}
assertEquals(oversized, regionCache.size());
// Lastly run cleanup to apply the configured limits. Note that the TTL is not tested here
// simply for simplicity (and for the speed of this test)
LocalRegionCacheTest.runCleanup(regionCache);
// The default size is 100,000, so if the configuration is ignored no elements will be removed. But
// if the configuration is applied as expected
assertTrue(regionCache.size() <= 50);
verify(mapConfig).getMaxSizeConfig();
verify(mapConfig, times(3)).getTimeToLiveSeconds(); // Should have been retrieved a second time by the cache
}