Definition extends BasicAttributeContext { @Override public int hashCode() { return nullSafeHashCode(name) + nullSafeHashCode(inherit) + super.hashCode(); } Definition();  Definition(Definition definition);  Definition(String name, Attribute templateAttribute,
                               Map<String, Attribute> attributes); String getName(); void setName(String aName); void setExtends(String name); String getExtends(); @Override boolean equals(Object obj); @Override int hashCode(); boolean isExtending(); @Override String toString();  }
@Test public void testHashCode() { Definition definition = new Definition(); definition.setName("myDefinition"); definition.setExtends("myExtends"); Attribute attribute1 = new Attribute("value1"); definition.putAttribute("name1", attribute1); Attribute attribute2 = new Attribute("value2"); definition.putAttribute("name2", attribute2); BasicAttributeContext attributeContext = new BasicAttributeContext(); attributeContext.putAttribute("name1", attribute1); attributeContext.putAttribute("name2", attribute2); assertEquals("myDefinition".hashCode() + "myExtends".hashCode() + attributeContext.hashCode(), definition.hashCode()); }