@Test(expected = IllegalArgumentException.class) public void remove() throws Exception { PatchOperation op = PatchOperation.remove("/foo"); underTest.convertOperation(null, op); }
@Override public PatchOperation convertOperation(Road road, PatchOperation modelOperation) { checkArgument(modelOperation.getOperation() != REMOVE, "only add or replace are supported"); checkArgument(modelOperation.getValue() instanceof List, "value must be an array"); List<?> list = (List<?>) modelOperation.getValue(); if (!list.isEmpty()) { Object first = list.get(0); checkArgument(type.equals(first.getClass()), "array type must be a " + type.getSimpleName()); } return PatchOperation.replace(path, modelOperation.getValue()); }
ListPatchMapping extends PatchMapping { @Override public PatchOperation convertOperation(Road road, PatchOperation modelOperation) { checkArgument(modelOperation.getOperation() != REMOVE, "only add or replace are supported"); checkArgument(modelOperation.getValue() instanceof List, "value must be an array"); List<?> list = (List<?>) modelOperation.getValue(); if (!list.isEmpty()) { Object first = list.get(0); checkArgument(type.equals(first.getClass()), "array type must be a " + type.getSimpleName()); } return PatchOperation.replace(path, modelOperation.getValue()); } }
ListPatchMapping extends PatchMapping { @Override public PatchOperation convertOperation(Road road, PatchOperation modelOperation) { checkArgument(modelOperation.getOperation() != REMOVE, "only add or replace are supported"); checkArgument(modelOperation.getValue() instanceof List, "value must be an array"); List<?> list = (List<?>) modelOperation.getValue(); if (!list.isEmpty()) { Object first = list.get(0); checkArgument(type.equals(first.getClass()), "array type must be a " + type.getSimpleName()); } return PatchOperation.replace(path, modelOperation.getValue()); }  }
ListPatchMapping extends PatchMapping { @Override public PatchOperation convertOperation(Road road, PatchOperation modelOperation) { checkArgument(modelOperation.getOperation() != REMOVE, "only add or replace are supported"); checkArgument(modelOperation.getValue() instanceof List, "value must be an array"); List<?> list = (List<?>) modelOperation.getValue(); if (!list.isEmpty()) { Object first = list.get(0); checkArgument(type.equals(first.getClass()), "array type must be a " + type.getSimpleName()); } return PatchOperation.replace(path, modelOperation.getValue()); }  @Override String getPath(); @Override PatchOperation convertOperation(Road road, PatchOperation modelOperation); }
ListPatchMapping extends PatchMapping { @Override public PatchOperation convertOperation(Road road, PatchOperation modelOperation) { checkArgument(modelOperation.getOperation() != REMOVE, "only add or replace are supported"); checkArgument(modelOperation.getValue() instanceof List, "value must be an array"); List<?> list = (List<?>) modelOperation.getValue(); if (!list.isEmpty()) { Object first = list.get(0); checkArgument(type.equals(first.getClass()), "array type must be a " + type.getSimpleName()); } return PatchOperation.replace(path, modelOperation.getValue()); }  @Override String getPath(); @Override PatchOperation convertOperation(Road road, PatchOperation modelOperation);  }