@Test public void testMergeMetadataFieldsFirstNull() { final JSONObject metadata1 = null; final JSONObject metadata2 = loadJsonObject("merge2.json"); final JSONObject expected = loadJsonObject("merge2.json"); final JSONObject actual = BulkUpdateUtil.mergeMetadataFields(metadata1, metadata2); assertThat(actual.toJSONString(), SameJSONAs.sameJSONAs(expected.toJSONString())); }
@SuppressWarnings("unchecked") public static JSONObject mergeMetadataFields(final JSONObject first, final JSONObject second) { if (first == null) { return second; } if (second == null) { return first; } final JSONObject result = deepCopy(first); final Collection fields = (Collection) result.get("fields"); fields.addAll((Collection) second.get("fields")); return result; }
BulkUpdateUtil { @SuppressWarnings("unchecked") public static JSONObject mergeMetadataFields(final JSONObject first, final JSONObject second) { if (first == null) { return second; } if (second == null) { return first; } final JSONObject result = deepCopy(first); final Collection fields = (Collection) result.get("fields"); fields.addAll((Collection) second.get("fields")); return result; } }
BulkUpdateUtil { @SuppressWarnings("unchecked") public static JSONObject mergeMetadataFields(final JSONObject first, final JSONObject second) { if (first == null) { return second; } if (second == null) { return first; } final JSONObject result = deepCopy(first); final Collection fields = (Collection) result.get("fields"); fields.addAll((Collection) second.get("fields")); return result; } private  BulkUpdateUtil(); }
BulkUpdateUtil { @SuppressWarnings("unchecked") public static JSONObject mergeMetadataFields(final JSONObject first, final JSONObject second) { if (first == null) { return second; } if (second == null) { return first; } final JSONObject result = deepCopy(first); final Collection fields = (Collection) result.get("fields"); fields.addAll((Collection) second.get("fields")); return result; } private  BulkUpdateUtil(); static Optional<Event> getEvent(
    final IndexService indexSvc,
    final AdminUISearchIndex index,
    final String id); @SuppressWarnings("unchecked") static JSONObject addSchedulingDates(final Event event, final JSONObject scheduling); @SuppressWarnings("unchecked") static JSONObject toNonTechnicalMetadataJson(final JSONObject scheduling); @SuppressWarnings("unchecked") static JSONObject mergeMetadataFields(final JSONObject first, final JSONObject second); }
BulkUpdateUtil { @SuppressWarnings("unchecked") public static JSONObject mergeMetadataFields(final JSONObject first, final JSONObject second) { if (first == null) { return second; } if (second == null) { return first; } final JSONObject result = deepCopy(first); final Collection fields = (Collection) result.get("fields"); fields.addAll((Collection) second.get("fields")); return result; } private  BulkUpdateUtil(); static Optional<Event> getEvent(
    final IndexService indexSvc,
    final AdminUISearchIndex index,
    final String id); @SuppressWarnings("unchecked") static JSONObject addSchedulingDates(final Event event, final JSONObject scheduling); @SuppressWarnings("unchecked") static JSONObject toNonTechnicalMetadataJson(final JSONObject scheduling); @SuppressWarnings("unchecked") static JSONObject mergeMetadataFields(final JSONObject first, final JSONObject second);  }