InMemoryConfiguration extends AbstractConfiguration { @Override public void define(final String key, final Object value) { checkReadOnly(); logger.debug("{}: {}", key, value); final int dotIndex = key.indexOf('.'); if (dotIndex < 0) { key2value.put(key, value); } else { final String subconfigurationName = key.substring(0, dotIndex); final String remainder = key.substring(dotIndex + 1); final Configuration subconfiguration = subconfigurations.get(subconfigurationName); if (null == subconfiguration) { final Configuration newSubconfiguration = new InMemoryConfiguration(); newSubconfiguration.define(remainder, value); subconfigurations.put(subconfigurationName, newSubconfiguration); } else { subconfiguration.define(remainder, value); } } } InMemoryConfiguration();  InMemoryConfiguration(final boolean readOnly);  InMemoryConfiguration(final Configuration configuration);  InMemoryConfiguration(final boolean readOnly, final Configuration configuration);  InMemoryConfiguration(final boolean readOnly, final Map<String, Object> map); @Override Map<String, Object> asMap(); @Override void define(final String key, final Object value); @Override Configuration getSubconfiguration(final String key); @Override void remove(final String key); @Override String toString(); @Override boolean equals(final Object obj);  }
@Test public void testDefine() { final InMemoryConfiguration inMemoryConfiguration = new InMemoryConfiguration(); final String fragment1 = randomUUID().toString(); final String fragment2 = randomUUID().toString(); final String key = fragment1 + "." + fragment2; final String value = randomUUID().toString(); inMemoryConfiguration.define(key, value); assertNotNull(inMemoryConfiguration.get(key)); logger.debug("Configuration: {}", inMemoryConfiguration); }