@Test(expected = IllegalArgumentException.class) public void remove_patch_fails() throws Exception { mapping.convertOperation(road, PatchOperation.remove("/enabled")); }
@Override public PatchOperation convertOperation(Road road, PatchOperation modelOperation) { checkArgument(isAddOrReplace(modelOperation), "You can only change the value of enabled"); checkArgument(modelOperation.getValue() instanceof Boolean, "enabled must be a boolean"); if (isTryingToEnableRoad(modelOperation)) { checkArgument(road.getStatus().isTopicCreated(), "Road is not ready and cannot be enabled"); } return PatchOperation.replace("/enabled", modelOperation.getValue()); }
EnabledPatchMapping extends PatchMapping { @Override public PatchOperation convertOperation(Road road, PatchOperation modelOperation) { checkArgument(isAddOrReplace(modelOperation), "You can only change the value of enabled"); checkArgument(modelOperation.getValue() instanceof Boolean, "enabled must be a boolean"); if (isTryingToEnableRoad(modelOperation)) { checkArgument(road.getStatus().isTopicCreated(), "Road is not ready and cannot be enabled"); } return PatchOperation.replace("/enabled", modelOperation.getValue()); } }
EnabledPatchMapping extends PatchMapping { @Override public PatchOperation convertOperation(Road road, PatchOperation modelOperation) { checkArgument(isAddOrReplace(modelOperation), "You can only change the value of enabled"); checkArgument(modelOperation.getValue() instanceof Boolean, "enabled must be a boolean"); if (isTryingToEnableRoad(modelOperation)) { checkArgument(road.getStatus().isTopicCreated(), "Road is not ready and cannot be enabled"); } return PatchOperation.replace("/enabled", modelOperation.getValue()); }  }
EnabledPatchMapping extends PatchMapping { @Override public PatchOperation convertOperation(Road road, PatchOperation modelOperation) { checkArgument(isAddOrReplace(modelOperation), "You can only change the value of enabled"); checkArgument(modelOperation.getValue() instanceof Boolean, "enabled must be a boolean"); if (isTryingToEnableRoad(modelOperation)) { checkArgument(road.getStatus().isTopicCreated(), "Road is not ready and cannot be enabled"); } return PatchOperation.replace("/enabled", modelOperation.getValue()); }  @Override String getPath(); @Override PatchOperation convertOperation(Road road, PatchOperation modelOperation); }
EnabledPatchMapping extends PatchMapping { @Override public PatchOperation convertOperation(Road road, PatchOperation modelOperation) { checkArgument(isAddOrReplace(modelOperation), "You can only change the value of enabled"); checkArgument(modelOperation.getValue() instanceof Boolean, "enabled must be a boolean"); if (isTryingToEnableRoad(modelOperation)) { checkArgument(road.getStatus().isTopicCreated(), "Road is not ready and cannot be enabled"); } return PatchOperation.replace("/enabled", modelOperation.getValue()); }  @Override String getPath(); @Override PatchOperation convertOperation(Road road, PatchOperation modelOperation);  }