Element implements ElementId { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (null == obj || getClass() != obj.getClass()) { return false; } final Element element = (Element) obj; return new EqualsBuilder() .append(group, element.group) .append(properties, element.properties) .isEquals(); } Element();   Element(final String group);   Element(final String group, final Properties properties); void putProperty(final String name, final Object value); void copyProperties(final Properties properties); Object getProperty(final String name); @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.WRAPPER_OBJECT, property = "class") Properties getProperties(); Object removeProperty(final String propName); String getGroup(); @Override int hashCode(); boolean shallowEquals(final Object obj); boolean shallowEquals(final Element element); @Override boolean equals(final Object obj); @Override String toString(); @JsonIgnore abstract Element emptyClone(); Element shallowClone(); @JsonIgnore abstract Object getIdentifier(final IdentifierType identifierType); @JsonIgnore Element getElement(); static final String DEFAULT_GROUP; }
@Test public void shouldReturnFalseForEqualsWithNullObject() { final Element element1 = newElement("group"); boolean isEqual = element1.equals((Object) null); assertFalse(isEqual); }
@Test public void shouldReturnFalseForEqualsWithNullElement() { final Element element1 = newElement("group"); boolean isEqual = element1.equals(null); assertFalse(isEqual); }