HierachicalConfiguration extends AbstractConfiguration { @Override public Configuration getSubconfiguration(final String key) { if (null == parent) { return configuration.getSubconfiguration(key); } return HierachicalConfiguration.create(parent.getSubconfiguration(key), configuration.getSubconfiguration(key)); } HierachicalConfiguration(final Configuration configuration); static Configuration create(final Configuration... configurations); @Override Configuration getSubconfiguration(final String key); @Override Object getValue(final String key); @Override Map<String, Object> asMap(); @Override void define(final String key, final Object value); @Override void remove(String key);  }
@Test public void testGetSubConfiguration() { final String parentKey = "parent"; final String childKey = "child"; final String key = parentKey + "." + childKey; final String v1 = randomUUID().toString(); final String v2 = randomUUID().toString(); InMemoryConfiguration conf1 = new InMemoryConfiguration(); conf1.define(key, v1); InMemoryConfiguration conf2 = new InMemoryConfiguration(); conf1.define(key, v2); Configuration conf = HierachicalConfiguration.create(conf1, conf2); Configuration subConf = conf.getSubconfiguration(parentKey); assertEquals(v2, subConf.get(childKey)); }