@Test void operationsAreCalledInOrder() { final JsonNode node1 = FACTORY.textNode("hello"); final JsonNode node2 = FACTORY.textNode("world"); when(op1.apply(node1)).thenReturn(node2); final JsonPatch patch = new JsonPatch(ImmutableList.of(op1, op2)); final ArgumentCaptor<JsonNode> captor = ArgumentCaptor.forClass(JsonNode.class); patch.apply(node1); verify(op1, only()).apply(same(node1)); verify(op2, only()).apply(captor.capture()); assertThat(captor.getValue()).isSameAs(node2); }
public JsonNode apply(final JsonNode node) { requireNonNull(node, "node"); JsonNode ret = node.deepCopy(); for (final JsonPatchOperation operation : operations) { ret = operation.apply(ret); } return ret; }
JsonPatch implements JsonSerializable { public JsonNode apply(final JsonNode node) { requireNonNull(node, "node"); JsonNode ret = node.deepCopy(); for (final JsonPatchOperation operation : operations) { ret = operation.apply(ret); } return ret; } }
JsonPatch implements JsonSerializable { public JsonNode apply(final JsonNode node) { requireNonNull(node, "node"); JsonNode ret = node.deepCopy(); for (final JsonPatchOperation operation : operations) { ret = operation.apply(ret); } return ret; } @JsonCreator  JsonPatch(final List<JsonPatchOperation> operations); }
JsonPatch implements JsonSerializable { public JsonNode apply(final JsonNode node) { requireNonNull(node, "node"); JsonNode ret = node.deepCopy(); for (final JsonPatchOperation operation : operations) { ret = operation.apply(ret); } return ret; } @JsonCreator  JsonPatch(final List<JsonPatchOperation> operations); static JsonPatch fromJson(final JsonNode node); static JsonPatch generate(final JsonNode source, final JsonNode target, ReplaceMode replaceMode); boolean isEmpty(); List<JsonPatchOperation> operations(); JsonNode apply(final JsonNode node); ArrayNode toJson(); @Override String toString(); @Override void serialize(final JsonGenerator jgen, final SerializerProvider provider); @Override void serializeWithType(final JsonGenerator jgen,
                                  final SerializerProvider provider, final TypeSerializer typeSer); }
JsonPatch implements JsonSerializable { public JsonNode apply(final JsonNode node) { requireNonNull(node, "node"); JsonNode ret = node.deepCopy(); for (final JsonPatchOperation operation : operations) { ret = operation.apply(ret); } return ret; } @JsonCreator  JsonPatch(final List<JsonPatchOperation> operations); static JsonPatch fromJson(final JsonNode node); static JsonPatch generate(final JsonNode source, final JsonNode target, ReplaceMode replaceMode); boolean isEmpty(); List<JsonPatchOperation> operations(); JsonNode apply(final JsonNode node); ArrayNode toJson(); @Override String toString(); @Override void serialize(final JsonGenerator jgen, final SerializerProvider provider); @Override void serializeWithType(final JsonGenerator jgen,
                                  final SerializerProvider provider, final TypeSerializer typeSer);  }