RegionConfigRealizer implements ConfigurationRealizer<Region, RuntimeRegionInfo> { @Override public boolean exists(Region config, InternalCache cache) { org.apache.geode.cache.Region<Object, Object> region = cache.getRegion(SEPARATOR + config.getName()); if (region == null) { return false; } if (region.isDestroyed()) { return false; } return true; }  @Override RealizationResult create(Region regionConfig, InternalCache cache); RealizationResult create(RegionConfig regionConfig, String regionPath,
      InternalCache cache); @Override RuntimeRegionInfo get(Region config, InternalCache cache); @Override boolean exists(Region config, InternalCache cache); @Override RealizationResult update(Region config, InternalCache cache); @Override RealizationResult delete(Region config, InternalCache cache);  }
@Test public void regionDoesNotExistIfNotInCache() { config.setName("test"); when(cache.getRegion(SEPARATOR + "test")).thenReturn(null); assertThat(realizer.exists(config, cache)).isFalse(); }
@Test public void regionDoesNotExistIfDestroyed() { when(cache.getRegion(SEPARATOR + "test")).thenReturn(region); when(region.isDestroyed()).thenReturn(true); assertThat(realizer.exists(config, cache)).isFalse(); }
@Test public void regionExistsDoesNotGetRuntimeInfo() { config.setName("test"); when(cache.getRegion(SEPARATOR + "test")).thenReturn(region); when(region.isDestroyed()).thenReturn(false); boolean exists = realizer.exists(config, cache); assertThat(exists).isTrue(); verify(region, never()).size(); }