MappingCommandUtils { public static ArrayList<RegionMapping> getMappingsFromRegionConfig(CacheConfig cacheConfig, RegionConfig regionConfig, String group) { ArrayList<RegionMapping> results = new ArrayList<>(); for (CacheElement element : regionConfig.getCustomRegionElements()) { if (element instanceof RegionMapping) { ((RegionMapping) element).setRegionName(regionConfig.getName()); results.add((RegionMapping) element); } } return results; }  static CacheConfig getCacheConfig(ConfigurationPersistenceService configService,
      String group); static RegionConfig checkForRegion(String regionName, CacheConfig cacheConfig,
      String groupName); static ArrayList<RegionMapping> getMappingsFromRegionConfig(CacheConfig cacheConfig,
      RegionConfig regionConfig,
      String group); static boolean isMappingSynchronous(CacheConfig cacheConfig, RegionConfig regionConfig); static CacheConfig.AsyncEventQueue findAsyncEventQueue(CacheConfig cacheConfig,
      RegionConfig regionConfig); static boolean isAccessor(RegionAttributesType attributesType); static boolean isPartition(RegionAttributesType attributesType); static String createAsyncEventQueueName(String regionPath);  }
@Test public void getMappingsFromRegionConfigReturnsCorrectMappings() { RegionMapping validRegionMapping = mock(RegionMapping.class); CacheElement invalidRegionMapping = mock(CacheElement.class); List<CacheElement> cacheElements = new ArrayList<>(); cacheElements.add((CacheElement) validRegionMapping); cacheElements.add(invalidRegionMapping); when(regionConfig.getCustomRegionElements()).thenReturn(cacheElements); List<RegionMapping> results = MappingCommandUtils.getMappingsFromRegionConfig(cacheConfig, regionConfig, GROUPNAME); assertThat(results.size()).isEqualTo(1); assertThat(results.get(0)).isEqualTo(validRegionMapping); }