void initializeRegions(Map<String, Region<?, ?>> declarativeRegions, Cache cache) { for (Region region : declarativeRegions.values()) { RegionCreation regionCreation = (RegionCreation) region; regionCreation.createRoot(cache); } }
@Test public void declarativeRegionIsCreated() { CacheCreation cacheCreation = new CacheCreation(); RegionCreation declarativeRegion = mock(RegionCreation.class); when(declarativeRegion.getName()).thenReturn("testRegion"); Map<String, Region<?, ?>> declarativeRegions = new HashMap<>(); declarativeRegions.put("testRegion", declarativeRegion); when(this.cache.getRegion("testRegion")).thenReturn(null); cacheCreation.initializeRegions(declarativeRegions, this.cache); verify(declarativeRegion, times(1)).createRoot(this.cache); }
regionCreation.createRoot(cache);