doc.addDocumentListener(this);
doc.addUndoableEditListener(this);
doc.insertString(0, "01234" + "\u05DC\u05DD\u05DE\u05DF\u05E0", null);
doc.remove(3, 4);
// Save what we've got
DefaultDocumentEvent insertEvent = insert;
//Element insertChildrenAdded[] = insert.
DefaultDocumentEvent removeEvent = remove;
assertSame(undoEvent.getEdit(), remove);
insert = null;
remove = null;
undoEvent = null;
// Try to undo
removeEvent.undo();
assertNull(remove);
assertNotNull(insert);
assertNull(undoEvent);
DefaultDocumentEvent undoInsertEvent = insert;
insert = null;
insertEvent.undo();
assertNotNull(remove);
assertNull(insert);
assertNull(undoEvent);
DefaultDocumentEvent undoRemoveEvent = remove;
remove = null;
assertFalse(undoInsertEvent.canUndo());
assertTrue(undoInsertEvent.canRedo());
assertSame(insertEvent, undoRemoveEvent);
assertSame(EventType.INSERT, insertEvent.getType());
assertSame(EventType.INSERT, undoRemoveEvent.getType());
assertFalse(undoRemoveEvent.canUndo());
assertTrue(undoRemoveEvent.canRedo());
assertSame(removeEvent, undoInsertEvent);
assertSame(EventType.REMOVE, removeEvent.getType());
assertSame(EventType.REMOVE, undoInsertEvent.getType());
//undoInsertEvent.undo();
//insertEvent.redo();