class SystemPropertiesConfiguration extends AbstractConfiguration implements Configuration {

  @Override
  public Configuration getSubconfiguration(final String key) {
    final String prefix = key + ".";
    final InMemoryConfiguration subconfiguration = new InMemoryConfiguration();

    Set<String> stringProperties = getProperties().stringPropertyNames();
    for (final String name : stringProperties) {
      if (name.startsWith(prefix)) {
        final String subname = name.substring(prefix.length());
        subconfiguration.define(subname, getProperty(name));
      }
    }
    return subconfiguration;
  }

}

class SystemPropertiesConfigurationTest extends AbstractConfiguration {

  @Test
  public void testGetSubConfiguration() {

    final SystemPropertiesConfiguration configuration = new SystemPropertiesConfiguration();
    final Configuration subConfiguration =
        configuration.getSubconfiguration(randomUUID().toString());
    assertNotNull(subConfiguration);
  }

}