@Test
public void testAttributes() throws Exception {

  PropertyInfo property = new PropertyInfo();
  List<Element> elements = new ArrayList<Element>();
  Element e1 = createNiceMock(Element.class);
  Element e2 = createNiceMock(Element.class);
  Node n1 = createNiceMock(Node.class);
  Node n2 = createNiceMock(Node.class);
  elements.add(e1);
  elements.add(e2);
  // set mock expectations
  expect(e1.getTagName()).andReturn("foo").anyTimes();
  expect(e1.getFirstChild()).andReturn(n1).anyTimes();
  expect(n1.getNodeValue()).andReturn("value1").anyTimes();
  expect(e2.getTagName()).andReturn("bar").anyTimes();
  expect(e2.getFirstChild()).andReturn(n2).anyTimes();
  expect(n2.getNodeValue()).andReturn("value2").anyTimes();
  replay(e1, e2, n1, n2);
  // set attributes
  Field f = property.getClass().getDeclaredField("propertyAttributes");
  f.setAccessible(true);
  f.set(property, elements);
  Map<String, String> attributes = property.getAttributesMap();
  assertEquals(2, attributes.size());
  assertEquals("value1", attributes.get("foo"));
  assertEquals("value2", attributes.get("bar"));
}