@Test public void add_converts_to_replace() throws Exception { PatchOperation operation = mapping.convertOperation(road, PatchOperation.add("/metadata", emptyMap())); assertThat(operation, is(PatchOperation.replace("/metadata", emptyMap()))); }
@Override public PatchOperation convertOperation(Road road, PatchOperation modelOperation) { checkArgument(isAddOrReplace(modelOperation), "You can only change the value of metadata"); checkArgument(modelOperation.getValue() instanceof Map, "metadata must be an object"); checkArgument(modelOperation.getValue() != null, "metadata cannot be null"); return PatchOperation.replace("/metadata", modelOperation.getValue()); }
MetadataPatchMapping extends PatchMapping { @Override public PatchOperation convertOperation(Road road, PatchOperation modelOperation) { checkArgument(isAddOrReplace(modelOperation), "You can only change the value of metadata"); checkArgument(modelOperation.getValue() instanceof Map, "metadata must be an object"); checkArgument(modelOperation.getValue() != null, "metadata cannot be null"); return PatchOperation.replace("/metadata", modelOperation.getValue()); } }
MetadataPatchMapping extends PatchMapping { @Override public PatchOperation convertOperation(Road road, PatchOperation modelOperation) { checkArgument(isAddOrReplace(modelOperation), "You can only change the value of metadata"); checkArgument(modelOperation.getValue() instanceof Map, "metadata must be an object"); checkArgument(modelOperation.getValue() != null, "metadata cannot be null"); return PatchOperation.replace("/metadata", modelOperation.getValue()); }  }
MetadataPatchMapping extends PatchMapping { @Override public PatchOperation convertOperation(Road road, PatchOperation modelOperation) { checkArgument(isAddOrReplace(modelOperation), "You can only change the value of metadata"); checkArgument(modelOperation.getValue() instanceof Map, "metadata must be an object"); checkArgument(modelOperation.getValue() != null, "metadata cannot be null"); return PatchOperation.replace("/metadata", modelOperation.getValue()); }  @Override String getPath(); @Override PatchOperation convertOperation(Road road, PatchOperation modelOperation); }
MetadataPatchMapping extends PatchMapping { @Override public PatchOperation convertOperation(Road road, PatchOperation modelOperation) { checkArgument(isAddOrReplace(modelOperation), "You can only change the value of metadata"); checkArgument(modelOperation.getValue() instanceof Map, "metadata must be an object"); checkArgument(modelOperation.getValue() != null, "metadata cannot be null"); return PatchOperation.replace("/metadata", modelOperation.getValue()); }  @Override String getPath(); @Override PatchOperation convertOperation(Road road, PatchOperation modelOperation);  }