Commit f640da72 by Madhan Neethiraj

ATLAS-1516: fix unit test failure in DefaultMetadataServiceTest.testSpecialCharacters()

parent 5d8fae55
...@@ -215,7 +215,7 @@ public class DefaultMetadataServiceTest { ...@@ -215,7 +215,7 @@ public class DefaultMetadataServiceTest {
//verify that entity can be created with reserved characters in string value, array value and map key and value //verify that entity can be created with reserved characters in string value, array value and map key and value
Referenceable entity = new Referenceable(typeDefinition.typeName); Referenceable entity = new Referenceable(typeDefinition.typeName);
entity.set(strAttrName, randomStrWithReservedChars()); entity.set(strAttrName, randomStrWithReservedChars());
entity.set(arrayAttrName, new String[]{randomStrWithReservedChars()}); entity.set(arrayAttrName, new ArrayList<String>() {{ add(randomStrWithReservedChars()); }});
entity.set(mapAttrName, new HashMap<String, String>() {{ entity.set(mapAttrName, new HashMap<String, String>() {{
put(randomStrWithReservedChars(), randomStrWithReservedChars()); put(randomStrWithReservedChars(), randomStrWithReservedChars());
}}); }});
...@@ -244,7 +244,7 @@ public class DefaultMetadataServiceTest { ...@@ -244,7 +244,7 @@ public class DefaultMetadataServiceTest {
Referenceable newActual = new Referenceable(expected.getId(), actual.getTypeName(), actual.getValuesMap(), Referenceable newActual = new Referenceable(expected.getId(), actual.getTypeName(), actual.getValuesMap(),
traits, traitsMap); traits, traitsMap);
assertEquals(InstanceSerialization.toJson(newActual, true), InstanceSerialization.toJson(expected, true)); assertEquals(newActual, expected);
} }
private String randomStrWithReservedChars() { private String randomStrWithReservedChars() {
......
...@@ -162,7 +162,7 @@ public class Referenceable extends Struct implements IReferenceableInstance { ...@@ -162,7 +162,7 @@ public class Referenceable extends Struct implements IReferenceableInstance {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false; if (o == null || getClass() != o.getClass() || !super.equalsContents(o)) return false;
Referenceable that = (Referenceable) o; Referenceable that = (Referenceable) o;
return Objects.equals(id, that.id) && return Objects.equals(id, that.id) &&
Objects.equals(traits, that.traits) && Objects.equals(traits, that.traits) &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment