Source:
public void testCopyEntireSetNoAnnotationsOnDestItem() throws Exception { DispoItemData destItem = new DispoItemData(); destItem.setStatus(DispoStrings.Item_InComplete); destItem.setGuid(mockId5); destItem.setAnnotationsList(new JSONArray()); destItem.setDiscrepanciesList(new JSONObject()); JSONObject destDiscrepancies = new JSONObject(); destDiscrepancies.put(discrepancy1.getId(), DispoUtil.discrepancyToJsonObj(discrepancy1)); destDiscrepancies.put(discrepancy2.getId(), DispoUtil.discrepancyToJsonObj(discrepancy2)); destDiscrepancies.put(discrepancy3.getId(), DispoUtil.discrepancyToJsonObj(discrepancy3)); destDiscrepancies.put(discrepancy4.getId(), DispoUtil.discrepancyToJsonObj(discrepancy4)); destDiscrepancies.put(discrepancy5.getId(), DispoUtil.discrepancyToJsonObj(discrepancy5)); destItem.setDiscrepanciesList(destDiscrepancies); OperationReport reoprt = new OperationReport(); AnnotationCopier copier = new AnnotationCopier(connector); List<DispoItem> toModify = copier.copyEntireSet(Collections.singletonList(destItem), Collections.singletonList((DispoItem) sourceItem), true, reoprt); DispoItem modifiedItem = toModify.get(0); JSONArray modifiedItemAnnotations = modifiedItem.getAnnotationsList(); DispoAnnotationData newAnnotation = DispoUtil.jsonObjToDispoAnnotationData(modifiedItemAnnotations.getJSONObject(0)); DispoAnnotationData newAnnotation2 = DispoUtil.jsonObjToDispoAnnotationData(modifiedItemAnnotations.getJSONObject(1)); Assert.assertEquals("5-7", newAnnotation.getLocationRefs()); Assert.assertEquals("Manual Annotation", newAnnotation.getResolution()); Assert.assertEquals("8", newAnnotation2.getLocationRefs()); Assert.assertEquals("Manual Annotation2", newAnnotation2.getResolution()); Assert.assertEquals(2, modifiedItemAnnotations.length()); Assert.assertEquals(mockId5, modifiedItem.getGuid()); }

Target:
public void testCopyEntireSetNoAnnotationsOnDestItem() throws Exception { DispoItemData destItem = new DispoItemData(); destItem.setStatus(DispoStrings.Item_InComplete); destItem.setGuid(mockId5); destItem.setAnnotationsList(new JSONArray()); destItem.setDiscrepanciesList(new JSONObject()); JSONObject destDiscrepancies = new JSONObject(); destDiscrepancies.put(discrepancy1.getId(), DispoUtil.discrepancyToJsonObj(discrepancy1)); destDiscrepancies.put(discrepancy2.getId(), DispoUtil.discrepancyToJsonObj(discrepancy2)); destDiscrepancies.put(discrepancy3.getId(), DispoUtil.discrepancyToJsonObj(discrepancy3)); destDiscrepancies.put(discrepancy4.getId(), DispoUtil.discrepancyToJsonObj(discrepancy4)); destDiscrepancies.put(discrepancy5.getId(), DispoUtil.discrepancyToJsonObj(discrepancy5)); destItem.setDiscrepanciesList(destDiscrepancies); OperationReport report = new OperationReport(); AnnotationCopier copier = new AnnotationCopier(connector); List<DispoItem> toModify = copier.copyEntireSet(Collections.singletonList(destItem), Collections.singletonList((DispoItem) sourceItem), true, report); DispoItem modifiedItem = toModify.get(0); JSONArray modifiedItemAnnotations = modifiedItem.getAnnotationsList(); DispoAnnotationData newAnnotation = DispoUtil.jsonObjToDispoAnnotationData(modifiedItemAnnotations.getJSONObject(0)); DispoAnnotationData newAnnotation2 = DispoUtil.jsonObjToDispoAnnotationData(modifiedItemAnnotations.getJSONObject(1)); Assert.assertEquals("5-7", newAnnotation.getLocationRefs()); Assert.assertEquals("Manual Annotation", newAnnotation.getResolution()); Assert.assertEquals("8", newAnnotation2.getLocationRefs()); Assert.assertEquals("Manual Annotation2", newAnnotation2.getResolution()); Assert.assertEquals(2, modifiedItemAnnotations.length()); Assert.assertEquals(mockId5, modifiedItem.getGuid()); }