Element implements IAttributes { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Element other = (Element) obj; return this.id.equals(other.id); } 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 testEquals() { Element parent = new Element("id"); Element element = new Element(parent); Assert.assertEquals(element, element); Assert.assertNotEquals(element, null); Assert.assertEquals(element, parent); }