@Test public void testEquals() { 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); Definition toCheck = new Definition(definition); assertTrue(definition.equals(toCheck)); toCheck = new Definition(definition); toCheck.setName("anotherDefinition"); assertFalse(definition.equals(toCheck)); toCheck = new Definition(definition); toCheck.setExtends("anotherExtends"); assertFalse(definition.equals(toCheck)); toCheck = new Definition(definition); toCheck.putAttribute("name1", new Attribute("anotherAttribute")); assertFalse(definition.equals(toCheck)); }
@Override public boolean equals(Object obj) { Definition def = (Definition) obj; return nullSafeEquals(name, def.name) && nullSafeEquals(inherit, def.inherit) && super.equals(def); }
Definition extends BasicAttributeContext { @Override public boolean equals(Object obj) { Definition def = (Definition) obj; return nullSafeEquals(name, def.name) && nullSafeEquals(inherit, def.inherit) && super.equals(def); } }
Definition extends BasicAttributeContext { @Override public boolean equals(Object obj) { Definition def = (Definition) obj; return nullSafeEquals(name, def.name) && nullSafeEquals(inherit, def.inherit) && super.equals(def); } Definition();  Definition(Definition definition);  Definition(String name, Attribute templateAttribute,
                               Map<String, Attribute> attributes); }
Definition extends BasicAttributeContext { @Override public boolean equals(Object obj) { Definition def = (Definition) obj; return nullSafeEquals(name, def.name) && nullSafeEquals(inherit, def.inherit) && super.equals(def); } 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(); }
Definition extends BasicAttributeContext { @Override public boolean equals(Object obj) { Definition def = (Definition) obj; return nullSafeEquals(name, def.name) && nullSafeEquals(inherit, def.inherit) && super.equals(def); } 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();  }