doc.setCharacterAttributes(2, 2, attrs, false);
List<?> edits = getEdits(event);
assertEquals(2, edits.size());
assertChange(edits.get(0), root.getElement(0), 0, new int[] { 0, 2, 2, 4, 4, 6 },
new int[] { 0, 6 });
AttributeUndoableEdit attrEdit = (AttributeUndoableEdit) edits.get(1);
assertFalse(attrEdit.isReplacing);
assertEquals(SimpleAttributeSet.EMPTY, attrEdit.copy);
assertEquals(attrs, attrEdit.newAttributes);
assertSame(root.getElement(0).getElement(1), attrEdit.element);
final Element leaf = root.getElement(0).getElement(1);
assertEquals(attrs, leaf.getAttributes());
doc.writeLock();
try {
attrEdit.undo();
} finally {
doc.writeUnlock();
}
assertEquals(SimpleAttributeSet.EMPTY, leaf.getAttributes());
}