### Question:
TreeDifference { public SortedMap<NodeRef, NodeRef> findChanges() { SortedMap<String, MutableTree> leftEntries = leftTree.getChildrenAsMap(); SortedMap<String, MutableTree> rightEntries = rightTree.getChildrenAsMap(); final Map<NodeRef, NodeRef> pureMetadataChanges = findPureMetadataChanges(); SortedMapDifference<String, MutableTree> difference; difference = difference(leftEntries, rightEntries); SortedMap<String, ValueDifference<MutableTree>> entriesDiffering; entriesDiffering = difference.entriesDiffering(); SortedMap<NodeRef, NodeRef> matches = Maps.newTreeMap(MutableTree.DEEPEST_FIRST_COMPARATOR); for (Map.Entry<String, ValueDifference<MutableTree>> e : entriesDiffering.entrySet()) { String nodePath = e.getKey(); String parentPath = NodeRef.parentPath(nodePath); ValueDifference<MutableTree> vd = e.getValue(); MutableTree left = vd.leftValue(); MutableTree right = vd.rightValue(); NodeRef lref = new NodeRef(left.getNode(), parentPath, ObjectId.NULL); NodeRef rref = new NodeRef(right.getNode(), parentPath, ObjectId.NULL); if (!pureMetadataChanges.containsKey(lref)) { matches.put(lref, rref); } } return matches; } TreeDifference(MutableTree leftTree, MutableTree rightTree); static TreeDifference create(MutableTree leftTree, MutableTree rightTree); MutableTree getLeftTree(); MutableTree getRightTree(); TreeDifference inverse(); SortedMap<NodeRef, NodeRef> findRenames(); SortedSet<NodeRef> findNewTrees(); SortedSet<NodeRef> findDeletes(); SortedMap<NodeRef, NodeRef> findChanges(); Map<NodeRef, NodeRef> findPureMetadataChanges(); boolean areEqual();  }### Answer:
@Test public void testFindChanges() { Map<NodeRef, NodeRef> changes = treeDifference.findChanges(); assertNotNull(changes); assertEquals(changes.toString(), 2, changes.size()); NodeRef l1 = tree("roads", "a1", null); NodeRef r1 = tree("roads", "a11", null); NodeRef l2 = tree("buildings", "a4", null); NodeRef r2 = tree("buildings", "a41", null); assertEquals(r1, changes.get(l1)); assertEquals(r2, changes.get(l2)); }