### Question:
XMLProperties { public synchronized String getProperty(String name) { return getProperty(name, true); } XMLProperties();  XMLProperties(String fileName);  XMLProperties(InputStream in); @Deprecated  XMLProperties(File file);  XMLProperties(Path file); synchronized String getProperty(String name); synchronized String getProperty(String name, boolean ignoreEmpty); List<String> getProperties(String name, boolean ignored); String[] getProperties(String name); Iterator getChildProperties(String name); String getAttribute(String name, String attribute); String removeAttribute(String name, String attribute); void setProperties(String name, List<String> values); boolean addToList(String propertyName, String value); boolean removeFromList(String propertyName, String value); List<String> getAllPropertyNames(); String[] getChildrenProperties(String parent); synchronized boolean setProperty(String name, String value); synchronized void deleteProperty(String name); void migrateProperty(String name); void setProperties(Map<String, String> propertyMap);  }### Answer:
@Test public void testGetProperty() throws Exception { XMLProperties props = new XMLProperties(getClass().getResourceAsStream("XMLProperties.test01.xml")); assertEquals("123", props.getProperty("foo.bar")); assertEquals("456", props.getProperty("foo.bar.baz")); assertNull(props.getProperty("foo")); assertNull(props.getProperty("nothing.something")); }
@Test public void testGetPropertyWithXMLEntity() throws Exception { String xml = "<root><foo>foo&amp;bar</foo></root>"; XMLProperties props = new XMLProperties(new ByteArrayInputStream(xml.getBytes())); assertEquals("foo&bar", props.getProperty("foo")); }