public Map<String, String> getPropertiesWithPrefix(String prefix) {
    return getPropertiesWithPrefix(prefix, false);
  }
@Test
  public void testGetPropertiesWithPrefix() {
    ConfigurationProperties configurationProperties =
        new ConfigurationProperties(PROPERTIES);

    Map<String, String> props = configurationProperties
        .getPropertiesWithPrefix("root.1.2");

    Assert.assertEquals(4, props.size());
    Assert.assertTrue(props.containsKey(""));
    Assert.assertEquals("TEST_VALUE_3", props.get(""));
    Assert.assertTrue(props.containsKey("4"));
    Assert.assertEquals("TEST_VALUE_3_1", props.get("4"));
    Assert.assertTrue(props.containsKey("3"));
    Assert.assertEquals("TEST_VALUE_1", props.get("3"));
    Assert.assertTrue(props.containsKey("4.5"));
    Assert.assertEquals("TEST_VALUE_3_2", props.get("4.5"));

    // Test the scenario where the prefix has a dot appended to it
    // (see CapacitySchedulerConfiguration.getQueuePrefix(String queue)).
    // The dot is disregarded.
    props = configurationProperties
        .getPropertiesWithPrefix("root.1.2.4.");

    Assert.assertEquals(2, props.size());
    Assert.assertTrue(props.containsKey(""));
    Assert.assertEquals("TEST_VALUE_3_1", props.get(""));
    Assert.assertTrue(props.containsKey("5"));
    Assert.assertEquals("TEST_VALUE_3_2", props.get("5"));

    Map<String, String> propsWithRootPrefix = configurationProperties
        .getPropertiesWithPrefix("root");

    Assert.assertEquals(6, propsWithRootPrefix.size());
    Assert.assertTrue(propsWithRootPrefix.containsKey(""));
    Assert.assertEquals("TEST_VALUE_4", propsWithRootPrefix.get(""));
    Assert.assertTrue(propsWithRootPrefix.containsKey("1.2.3"));
    Assert.assertEquals("TEST_VALUE_1", propsWithRootPrefix.get("1.2.3"));
    Assert.assertTrue(propsWithRootPrefix.containsKey("1"));
    Assert.assertEquals("TEST_VALUE_2", propsWithRootPrefix.get("1"));
    Assert.assertTrue(propsWithRootPrefix.containsKey("1.2"));
    Assert.assertEquals("TEST_VALUE_3", propsWithRootPrefix.get("1.2"));
    Assert.assertTrue(propsWithRootPrefix.containsKey("1.2.4"));
    Assert.assertEquals("TEST_VALUE_3_1", propsWithRootPrefix.get("1.2.4"));
    Assert.assertTrue(propsWithRootPrefix.containsKey("1.2.4.5"));
    Assert.assertEquals("TEST_VALUE_3_2", propsWithRootPrefix.get("1.2.4.5"));
  }