AtlasMapType extends AtlasType { @Override public boolean validateValue(Object obj, String objName, List<String> messages) { boolean ret = true; if (obj != null) { if (obj instanceof Map) { Map<Object, Objects> map = (Map<Object, Objects>) obj; for (Map.Entry e : map.entrySet()) { Object key = e.getKey(); if (!keyType.isValidValue(key)) { ret = false; messages.add(objName + "." + key + ": invalid key for type " + getTypeName()); } else { Object value = e.getValue(); ret = valueType.validateValue(value, objName + "." + key, messages) && ret; } } } else { ret = false; messages.add(objName + "=" + obj + ": invalid value for type " + getTypeName()); } } return ret; } AtlasMapType(String keyTypeName, String valueTypeName);  AtlasMapType(AtlasType keyType, AtlasType valueType);  AtlasMapType(String keyTypeName, String valueTypeName, AtlasTypeRegistry typeRegistry); String getKeyTypeName(); String getValueTypeName(); AtlasType getKeyType(); AtlasType getValueType(); void setKeyType(AtlasType keyType); @Override void resolveReferences(AtlasTypeRegistry typeRegistry); @Override Map<Object, Object> createDefaultValue(); @Override boolean isValidValue(Object obj); @Override boolean isValidValueForUpdate(Object obj); @Override Map<Object, Object> getNormalizedValue(Object obj); @Override Map<Object, Object> getNormalizedValueForUpdate(Object obj); @Override boolean validateValue(Object obj, String objName, List<String> messages); @Override boolean validateValueForUpdate(Object obj, String objName, List<String> messages); @Override AtlasType getTypeForAttribute();  }
@Test public void testMapTypeValidateValue() { List<String> messages = new ArrayList<>(); for (Object value : validValues) { assertTrue(intIntMapType.validateValue(value, "testObj", messages)); assertEquals(messages.size(), 0, "value=" + value); } for (Object value : invalidValues) { assertFalse(intIntMapType.validateValue(value, "testObj", messages)); assertTrue(messages.size() > 0, "value=" + value); messages.clear(); } }