### Question:
XMLProperties { public String getAttribute(String name, String attribute) { if (name == null || attribute == null) { return null; } String[] propName = parsePropertyName(name); Element element = document.getRootElement(); for (String child : propName) { element = element.element(child); if (element == null) { break; } } if (element != null) { return element.attributeValue(attribute); } return null; } 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 testAttributes() throws Exception { String xml = "<root><foo></foo></root>"; XMLProperties props = new XMLProperties(new ByteArrayInputStream(xml.getBytes())); assertNull(props.getAttribute("foo","bar")); xml = "<root><foo bar=\"test123\"></foo></root>"; props = new XMLProperties(new ByteArrayInputStream(xml.getBytes())); assertEquals(props.getAttribute("foo","bar"), "test123"); }