Element implements IAttributes { @Override public Set<String> getAttributeNames() { Set<String> names = new HashSet<String>(); if (parent != null) { names.addAll(parent.getAttributeNames()); } names.addAll(attributes.getAttributeNames()); return names; } Element(String id);  Element(Element parent); String getId(); Element getParent(); void setParent(Element element); @SuppressWarnings("unchecked") @Override O getAttribute(String identifier); @Override boolean isDefined(String identifier); @Override Attributes getAttributes(); Attributes getLocalAttributes(); Set<String> getLocalAttributeNames(); @Override void setAttribute(String identifier, Object object); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); @Override Parameter getAttributeParameter(String identifier); @Override Set<String> getAttributeNames(); String getType(); void setType(String type); static String TYPE; }
@Test public void testGetAttributeNames() { Element element = new Element("id"); String id = "attribute name"; element.setAttribute(id, 0); Assert.assertEquals(1, element.getAttributeNames().size()); Assert.assertTrue(element.getAttributeNames().contains(id)); }