### Question:
KafkaUtils { static Properties getSubProperties(Map<String, String> prop, String prefix) { Properties p = new Properties(); for (Map.Entry<String, String> e : prop.entrySet()) { String key = e.getKey(); if (key.startsWith(prefix)) { p.put(key.substring(prefix.length()), e.getValue()); } } return p; } private  KafkaUtils();   }### Answer:
@Test public void testGetSubProperties() { Map<String, String> parent = Collections.singletonMap("foo.bar", "1"); Properties children = KafkaUtils.getSubProperties(parent, "foo."); assertEquals(1, children.size()); assertEquals("1", children.getProperty("bar")); }