}
@Test
public void testReversedPatch() throws Exception {
insert(points1, points2);
Patch patch = new Patch();
String path = NodeRef.appendChild(pointsName, points1.getIdentifier().getID());
Map<PropertyDescriptor, AttributeDiff> map = Maps.newHashMap();
Optional<?> oldValue = Optional.fromNullable(points1.getProperty("sp").getValue());
GenericAttributeDiffImpl diff = new GenericAttributeDiffImpl(oldValue, Optional.of("new"));
map.put(pointsType.getDescriptor("sp"), diff);
FeatureDiff feaureDiff = new FeatureDiff(path, map, RevFeatureTypeImpl.build(pointsType),
RevFeatureTypeImpl.build(pointsType));
patch.addModifiedFeature(feaureDiff);
String removedPath = NodeRef.appendChild(pointsName, points2.getIdentifier().getID());
patch.addRemovedFeature(removedPath, points2, RevFeatureTypeImpl.build(pointsType));
String addedPath = NodeRef.appendChild(pointsName, points3.getIdentifier().getID());
patch.addAddedFeature(addedPath, points3, RevFeatureTypeImpl.build(pointsType));
geogig.command(ApplyPatchOp.class).setPatch(patch).call();
geogig.command(ApplyPatchOp.class).setPatch(patch.reversed()).call();
RevTree root = repo.workingTree().getTree();
Optional<Node> featureBlobId = findTreeChild(root, removedPath);
assertTrue(featureBlobId.isPresent());
featureBlobId = findTreeChild(root, addedPath);
assertFalse(featureBlobId.isPresent());