### Question:
TenantConfigService implements RefreshableConfiguration { @IgnoreLogginAspect public Map<String, Object> getConfig() { return getTenantConfig(); } TenantConfigService(XmConfigProperties xmConfigProperties,
                               TenantContextHolder tenantContextHolder); @IgnoreLogginAspect Map<String, Object> getConfig(); @Override void onRefresh(final String updatedKey, final String config); String getTenantKey(String updatedKey); @Override boolean isListeningConfiguration(final String updatedKey); @Override void onInit(final String configKey, final String configValue); static final String DEFAULT_TENANT_CONFIG_PATTERN; }### Answer:
@Test public void testGetConfigValue() throws IOException { assertNotNull(tenantConfigService.getConfig()); assertEquals("value1", getConfig().get("testProperty")); }
@Test public void testCanNotChangeConfigMapOutside() throws IOException { assertEquals("value1", getConfig().get("testProperty")); assertEquals(1, tenantConfigService.getConfig().size()); try { tenantConfigService.getConfig().put("newProperty", "You've been hacked!"); fail("should not be success!!!"); } catch (UnsupportedOperationException e) { assertEquals(1, tenantConfigService.getConfig().size()); } Map<String, Object> map = getConfig(); try { map.put("testProperty", "You've been hacked!"); fail("should not be success!!!"); } catch (UnsupportedOperationException e) { assertEquals("value1", getConfig().get("testProperty")); } List<Object> list = List.class.cast(getConfig().get("testList")); assertEquals("item2", list.get(1)); assertEquals(3, list.size()); try { list.set(1, "replaced item!"); fail("should not be success!!!"); } catch (UnsupportedOperationException e) { assertEquals("item2", List.class.cast(getConfig().get("testList")).get(1)); } }