### Question:
EntityComparator implements IEntityVisitor { @Override public void processAttribute(IEntity currentEntity, MetaField metaField) { if (diff && !isRoot) { return; } if (metaField.isInternal()) { if (InternalFieldEnum.ID.getName().equals(metaField.getName()) && !diff) { diff = !org.apache.commons.lang.StringUtils.equals(currentEntity.getId(), sourceEntity.getId()); } return; } String fieldName = metaField.getName(); List<?> sourceValues = sourceEntity.getFieldValues(fieldName); if (!currentEntity.hasField(fieldName)) { diff = true; return; } List<?> destValues = currentEntity.getFieldValues(fieldName); boolean flag = diffAttributeValue(sourceValues, destValues); if(isRoot && !flag){ sourceEntity.removeField(metaField.getName()); } if(!diff){ diff = flag; } } EntityComparator(IEntity sourceEntity); protected  EntityComparator(IEntity sourceEntity, boolean isRoot); @Override Collection<String> getVisitFields(IEntity currentEntity); @Override void processAttribute(IEntity currentEntity, MetaField metaField); @Override void processReference(IEntity currentEntity, MetaRelationship metaRelationship); boolean getDiffResult(); void setRoot(boolean isRoot);  }### Answer:
@Test public void testProcessAttribute() { MetaClass metaClass = raptorMetaService.getMetaClass(APPLICATION_SERVICE); String found = "{ \"name\": \"appName-StringArray\", \"_type\": \"ApplicationService\", \"label\": \"lbmsstag1-app\", \"preManifestRef\": [\"lbms_master_old_wsdl_staging-0.1.20130710214948\", \"lbms_master_old_wsdl_staging-0.1.20130710214949\"]}"; String source= "{ \"name\": \"appName-StringArray\", \"_type\": \"ApplicationService\", \"label\": \"lbmsstag2-app\", \"preManifestRef\": [\"lbms_master_old_wsdl_staging-0.1.20130710214949\"], \"nugget\":null}"; IEntity foundEntity = new JsonEntity(metaClass, found); IEntity sourceEntity = new JsonEntity(metaClass, source); EntityComparator comparator = new EntityComparator(sourceEntity); MetaField metaField = metaClass.getFieldByName("name"); comparator.processAttribute(foundEntity, metaField); Assert.assertFalse(comparator.getDiffResult()); metaField = metaClass.getFieldByName("label"); comparator.processAttribute(foundEntity, metaField); Assert.assertTrue(comparator.getDiffResult()); metaField = metaClass.getFieldByName("preManifestRef"); comparator.processAttribute(foundEntity, metaField); Assert.assertTrue(comparator.getDiffResult()); metaField = metaClass.getFieldByName("nugget"); comparator.processAttribute(foundEntity, metaField); Assert.assertTrue(comparator.getDiffResult()); }