@Test public void mergeDefinitions_UpdatesFieldsDefinedInReplacementAndSource() throws Exception { JsonNode sourceDefinitions = mapper.readTree("{\"fields\": \"[{\\\"name\\\": \\\"fooField\\\", \\\"value\\\": \\\"old\\\"}]\", \"fieldFormatMap\": \"{\\\"foo\\\": {\\\"name\\\": \\\"fooOld\\\"}}\"}"); JsonNode stagemonitorDefinitions = mapper.readTree("{\"fields\": \"[{\\\"name\\\": \\\"fooField\\\", \\\"value\\\": \\\"new\\\"}]\", \"fieldFormatMap\": \"{\\\"foo\\\": {\\\"name\\\": \\\"fooNew\\\"}}\"}"); JsonNode resultDefinitions = JsonMerger.merge(sourceDefinitions, stagemonitorDefinitions, mergeStrategy); JsonNode resultFields = mapper.readTree(resultDefinitions.get("fields").textValue()); assertThat(resultFields).containsExactlyInAnyOrder( mapper.createObjectNode().put("name", "fooField").put("value", "new")); JsonNode resultFieldFormat = mapper.readTree(resultDefinitions.get("fieldFormatMap").textValue()); assertThat(resultFieldFormat).hasSize(1); assertThat(resultFieldFormat.get("foo")).isEqualTo(mapper.createObjectNode().put("name", "fooNew")); }
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();  }