### Question:
PropertiesUtils { public static Properties subProperties(Properties properties, String prefix) { Set<String> propertyNames = properties.stringPropertyNames(); Properties subProperties = new Properties(); for (String propertyName : propertyNames) { if (propertyName.startsWith(prefix)) { String subPropertyName = propertyName.substring(prefix.length()); if (subPropertyName.startsWith(".")) subPropertyName = subPropertyName.substring(1); subProperties.setProperty(subPropertyName, properties.getProperty(propertyName)); } } return subProperties; } private  PropertiesUtils(); static Properties subProperties(Properties properties, String prefix); static void listOrdered(Properties properties, Writer writer); static void copy(Properties source, Properties dest, CopyMode copyMode); static Properties loadFromResource(String resourceClasspath);  }### Answer:
@Test public void returns_sub_properties() { Properties props = new Properties(); props.setProperty("a.x", "1"); props.setProperty("b.x", "2"); Properties subprops = PropertiesUtils.subProperties(props, "a"); assertEquals("1", subprops.getProperty("x")); }