### Question:
AdditionalProperties extends AssetPropertyBase { @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (!(objectToCompare instanceof AdditionalProperties)) { return false; } if (!super.equals(objectToCompare)) { return false; } AdditionalProperties that = (AdditionalProperties) objectToCompare; return Objects.equals(additionalProperties, that.additionalProperties); } AdditionalProperties(Map<String, String>  additionalProperties);  AdditionalProperties(AssetDescriptor     parentAsset,
                                Map<String, String> additionalProperties);  AdditionalProperties(AssetDescriptor   parentAsset, AdditionalProperties templateProperties); Iterator<String> getPropertyNames(); String getProperty(String name); @Override boolean equals(Object objectToCompare); @Override String toString();  }### Answer:
@Test public void testEquals() { ElementType elementType = new ElementType(); Asset assetBean = new Asset(); elementType.setElementTypeName("TestTypeName"); assetBean.setQualifiedName("TestAssetName"); assetBean.setType(elementType); AssetDescriptor parentAsset = new AssetSummary(assetBean); Map<String, String> propertyMap = new HashMap<>(); AssetPropertyBase assetPropertyBase = new AdditionalProperties(parentAsset, propertyMap); AdditionalProperties additionalProperties = new AdditionalProperties(parentAsset, propertyMap); assertFalse(assetPropertyBase.equals("String Value")); assertTrue(assetPropertyBase.equals(assetPropertyBase)); assertTrue(assetPropertyBase.equals(additionalProperties)); assertTrue(additionalProperties.equals(assetPropertyBase)); ElementType differentElementType = new ElementType(); Asset differentAssetBean = new Asset(); differentElementType.setElementTypeName("DifferentTypeName"); differentAssetBean.setQualifiedName("TestAssetName"); differentAssetBean.setType(differentElementType); AssetDescriptor differentParentAsset = new AssetSummary(differentAssetBean); assertFalse(additionalProperties.equals(new AdditionalProperties(differentParentAsset, propertyMap))); }
@Test public void testValidParentAsset() { ElementType elementType = new ElementType(); Asset assetBean = new Asset(); elementType.setElementTypeName("TestTypeName"); assetBean.setQualifiedName("TestAssetName"); assetBean.setType(elementType); AssetDescriptor parentAsset = new AssetSummary(assetBean); AdditionalProperties template = null; Map<String, String> propertyMap = new HashMap<>(); AssetPropertyBase assetPropertyBase = new AdditionalProperties(parentAsset, template); assertTrue(assetPropertyBase.getParentAsset() == parentAsset); assertTrue(assetPropertyBase.getParentAssetName().equals("TestAssetName")); assertTrue(assetPropertyBase.getParentAssetTypeName().equals("TestTypeName")); assetPropertyBase = new AdditionalProperties(parentAsset, propertyMap); assertTrue(assetPropertyBase.getParentAsset() == parentAsset); assertTrue(assetPropertyBase.getParentAsset().equals(parentAsset)); assertTrue(assetPropertyBase.getParentAssetName().equals("TestAssetName")); assertTrue(assetPropertyBase.getParentAssetTypeName().equals("TestTypeName")); AssetDescriptor cloneParentAsset = new AssetSummary(assetBean); template = new AdditionalProperties(cloneParentAsset, propertyMap); assetPropertyBase = new AdditionalProperties(parentAsset, template); assertFalse(assetPropertyBase.getParentAsset() == cloneParentAsset); assertTrue(assetPropertyBase.getParentAsset() == parentAsset); assertTrue(assetPropertyBase.getParentAsset().equals(cloneParentAsset)); assertTrue(assetPropertyBase.getParentAsset().equals(parentAsset)); assertTrue(assetPropertyBase.getParentAssetName().equals("TestAssetName")); assertTrue(assetPropertyBase.getParentAssetTypeName().equals("TestTypeName")); }