### Question:
JsonPatchExample extends JsonExample { public JsonObject addAndRemove() { JsonPatchBuilder builder = Json.createPatchBuilder(); JsonPatch jsonPatch = builder .add("/comments", Json.createArrayBuilder().add("Very Good!").add("Excellent").build()) .remove("/notes") .build(); return jsonPatch.apply(jsonObject); }  String replace(); JsonObject addAndRemove(); JsonObject move(); JsonObject copy(); JsonObject test(); JsonObject toJsonArray();  }### Answer:
@Test public void givenPatchPath_shouldRemoveAndAdd() { JsonPatchExample jsonPatchExample = new JsonPatchExample(); JsonObject jsonObject = jsonPatchExample.addAndRemove(); JsonPointer pointer = Json.createPointer("/comments"); JsonValue jsonValue = pointer.getValue(jsonObject); assertThat(jsonValue.getValueType()).isEqualTo(JsonValue.ValueType.ARRAY); assertThat(jsonValue.asJsonArray().contains(Json.createValue("Very Good!"))).isTrue(); assertThat(jsonValue.asJsonArray().contains(Json.createValue("Excellent"))).isTrue(); pointer = Json.createPointer("/notes"); boolean contains = pointer.containsValue(jsonObject); assertThat(contains).isFalse(); }