second.findChild("child", "changedchild1").attributes.remove("deleteme");
VoltXMLElement temp = second.findChild("child", "changedchild2").findChild("child", "changedgrandchild");
temp.children.remove(temp.findChild("child", "doomeddescendent"));
VoltXMLDiff diff = VoltXMLElement.computeDiff(first, second);
Map<String, String> addedAtt = diff.getAddedAttributes();
assertEquals(1, addedAtt.size());
assertTrue(addedAtt.keySet().contains("added"));
assertEquals("addedval", addedAtt.get("added"));
Map<String, String> changedAtt = diff.getChangedAttributes();
assertEquals(1, changedAtt.size());
assertTrue(changedAtt.keySet().contains("changes"));
assertEquals("newvalue", changedAtt.get("changes"));
Set<String> removedAtt = diff.getRemovedAttributes();
assertEquals(1, removedAtt.size());
assertTrue(removedAtt.contains("deleted"));
List<VoltXMLElement> added = diff.getAddedNodes();
assertEquals(1, added.size());
assertTrue(findNamedNode(added, "addedchild") != null);
List<VoltXMLElement> removed = diff.getRemovedNodes();
assertEquals(1, removed.size());
assertTrue(findNamedNode(removed, "deletedchild") != null);
Map<String, VoltXMLDiff> changed = diff.getChangedNodes();
assertEquals(2, changed.size());
assertTrue(changed.containsKey("childchangedchild1"));
VoltXMLDiff child1 = changed.get("childchangedchild1");
assertTrue(child1.getRemovedAttributes().contains("deleteme"));
assertTrue(changed.containsKey("childchangedchild2"));
VoltXMLDiff child2 = changed.get("childchangedchild2");
assertTrue(child2.getChangedNodes().containsKey("childchangedgrandchild"));
VoltXMLDiff grandchild = child2.getChangedNodes().get("childchangedgrandchild");
assertTrue(findNamedNode(grandchild.getRemovedNodes(), "doomeddescendent") != null);
VoltXMLElement third = first.duplicate();
third.applyDiff(diff);
System.out.println(first.toMinString());
System.out.println(second.toMinString());