@Test public void mergeDefinitions_AddsFieldsDefinedInReplacement() throws Exception { JsonNode sourceDefinitions = mapper.readTree("{\"fields\": \"[{\\\"name\\\": \\\"sourceField\\\"}]\", \"fieldFormatMap\": \"{\\\"foo\\\": {\\\"name\\\": \\\"sourceFieldFormatMap\\\"}}\"}"); JsonNode stagemonitorDefinitions = mapper.readTree("{\"fields\": \"[{\\\"name\\\": \\\"stagemonitorField\\\"}]\", \"fieldFormatMap\": \"{\\\"stagemonitor\\\": {\\\"name\\\": \\\"stagemonitorFieldFormatMap\\\"}}\"}"); JsonNode resultDefinitions = JsonMerger.merge(sourceDefinitions, stagemonitorDefinitions, mergeStrategy); JsonNode resultFields = mapper.readTree(resultDefinitions.get("fields").textValue()); assertThat(resultFields).containsExactlyInAnyOrder( mapper.createObjectNode().put("name", "sourceField"), mapper.createObjectNode().put("name", "stagemonitorField")); JsonNode resultFieldFormat = mapper.readTree(resultDefinitions.get("fieldFormatMap").textValue()); assertThat(resultFieldFormat).hasSize(2); assertThat(resultFieldFormat.get("foo")).isEqualTo(mapper.createObjectNode().put("name", "sourceFieldFormatMap")); assertThat(resultFieldFormat.get("stagemonitor")).isEqualTo(mapper.createObjectNode().put("name", "stagemonitorFieldFormatMap")); }
public static JsonNode merge(JsonNode source, JsonNode replacement) throws IOException { return new MergeStrategy().execute(source, replacement); }
JsonMerger { public static JsonNode merge(JsonNode source, JsonNode replacement) throws IOException { return new MergeStrategy().execute(source, replacement); } }
JsonMerger { public static JsonNode merge(JsonNode source, JsonNode replacement) throws IOException { return new MergeStrategy().execute(source, replacement); }  }
JsonMerger { public static JsonNode merge(JsonNode source, JsonNode replacement) throws IOException { return new MergeStrategy().execute(source, replacement); }  static JsonNode merge(JsonNode source, JsonNode replacement); static JsonNode merge(JsonNode source, JsonNode replacement, MergeStrategy mergeStrategy); static MergeStrategy mergeStrategy(); }
JsonMerger { public static JsonNode merge(JsonNode source, JsonNode replacement) throws IOException { return new MergeStrategy().execute(source, replacement); }  static JsonNode merge(JsonNode source, JsonNode replacement); static JsonNode merge(JsonNode source, JsonNode replacement, MergeStrategy mergeStrategy); static MergeStrategy mergeStrategy();  }