void () { createClass("TestClass1"); Editor editor = openEditor("TestClass1.java"); WriteAction.runAndWait(() -> executeCommand(() -> editor.getDocument().insertString(27, "public class Aaa {}"))); PsiDocumentManager instance = PsiDocumentManager.getInstance(myProject); instance.commitAllDocuments(); PsiFile file = instance.getPsiFile(editor.getDocument()); PsiClass aaaClass = (PsiClass)file.getViewProvider().findElementAt(41).getParent(); IntentionAction fix = QuickFixFactory.getInstance().createMoveClassToSeparateFileFix(aaaClass); WriteAction.runAndWait(() -> executeCommand(() -> fix.invoke(myProject, editor, file))); instance.commitAllDocuments(); VirtualFile aaaFile = file.getVirtualFile().getParent().findChild("Aaa.java"); deleteInCommand(aaaFile); undo(editor); undo(editor); assertEquals("public class TestClass1 {\n}public class Aaa {}\n", editor.getDocument().getText()); }