### Question:
SchemaAttribute extends SchemaElement { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (objectToCompare == null || getClass() != objectToCompare.getClass()) { return false; } if (!super.equals(objectToCompare)) { return false; } SchemaAttribute that = (SchemaAttribute) objectToCompare; return elementPosition == that.elementPosition && minCardinality == that.minCardinality && maxCardinality == that.maxCardinality && allowsDuplicateValues == that.allowsDuplicateValues && orderedValues == that.orderedValues && Objects.equals(attributeName, that.attributeName) && Objects.equals(defaultValueOverride, that.defaultValueOverride) && sortOrder == that.sortOrder && Objects.equals(getAnchorGUID(), that.getAnchorGUID()) && Objects.equals(attributeType, that.attributeType) && Objects.equals(externalAttributeType, that.externalAttributeType) && Objects.equals(getAttributeRelationships(), that.getAttributeRelationships()) && Objects.equals(nativeJavaClass, that.nativeJavaClass) && Objects.equals(aliases, that.aliases); } SchemaAttribute();  SchemaAttribute(SchemaAttribute template); SchemaElement cloneSchemaElement(); String getAttributeName(); void setAttributeName(String attributeName); int getElementPosition(); void setElementPosition(int elementPosition); SchemaAttributeCategory getCategory(); @SuppressWarnings(value = "unused") void setCategory(SchemaAttributeCategory category); String getCardinality(); void setCardinality(String cardinality); int getMinCardinality(); void setMinCardinality(int minCardinality); int getMaxCardinality(); void setMaxCardinality(int maxCardinality); boolean isAllowsDuplicateValues(); void setAllowsDuplicateValues(boolean allowsDuplicateValues); boolean isOrderedValues(); void setOrderedValues(boolean orderedValues); DataItemSortOrder getSortOrder(); void setSortOrder(DataItemSortOrder sortOrder); int getMinimumLength(); void setMinimumLength(int minimumLength); int getLength(); void setLength(int length); int getSignificantDigits(); void setSignificantDigits(int significantDigits); boolean isNullable(); void setNullable(boolean nullable); String getDefaultValueOverride(); void setDefaultValueOverride(String defaultValueOverride); String getAnchorGUID(); void setAnchorGUID(String anchorGUID); SchemaType getAttributeType(); void setAttributeType(SchemaType attributeType); SchemaLink getExternalAttributeType(); void setExternalAttributeType(SchemaLink externalAttributeType); List<SchemaAttributeRelationship> getAttributeRelationships(); void setAttributeRelationships(List<SchemaAttributeRelationship> attributeRelationships); String getNativeJavaClass(); void setNativeJavaClass(String nativeJavaClass); List<String> getAliases(); void setAliases(List<String> aliases); @Override String toString(); @Override boolean equals(Object objectToCompare); @Override int hashCode();  }### Answer:
@Test public void testEquals() { assertFalse(getTestObject().equals(null)); assertFalse(getTestObject().equals("DummyString")); assertTrue(getTestObject().equals(getTestObject())); SchemaAttribute sameObject = getTestObject(); assertTrue(sameObject.equals(sameObject)); SchemaAttribute differentObject = getTestObject(); differentObject.setGUID("Different"); assertFalse(getTestObject().equals(differentObject)); differentObject = getTestObject(); differentObject.setAttributeName("Different"); assertFalse(getTestObject().equals(differentObject)); }